/* Bảng màu Pacvina 2026: Mint Dream #34D399→#D9F99D · Lavender Sky #6AA4FF→#C3CFE2 · Coral Sunset #FF9A9E→#FAD0C4 · Midnight Blue #243B55→#141E30
   Font: Reddit Sans (giao diện) + Old Standard TT (tiêu đề lớn) */
:root {
  --accent: #34d399;          /* mint — nền nút chính, trạng thái đang chọn */
  --accent-hover: #2bc48c;
  --accent-dark: #087a55;     /* mint đậm — viền, biểu tượng, liên kết */
  --accent-ink: #047857;      /* chữ màu mint trên nền sáng (đủ tương phản) */
  --accent-soft: #e7faf2;
  --accent-2: #d9f99d;        /* lime nhạt */
  --on-accent: #0f1b2d;       /* chữ trên nền mint */
  --lav: #6aa4ff; --lav-2: #c3cfe2; --lav-soft: #edf3ff; --lav-ink: #2f63c7;
  --coral: #ff9a9e; --coral-2: #fad0c4; --coral-soft: #fff1ef;
  --pink: #ff7f86;            /* nhấn phụ / cảnh báo nhẹ */
  --ink: #141e30;             /* midnight */
  --ink-2: #243b55;
  --linen: #e6ebf2;
  --bg: #f3f5f9;
  --panel: #ffffff;
  --line: #e2e7ef;
  --muted: #627083;
  --canvas-bg: #edf0f5;
  /* Token bổ sung 16/10/2026 — quy tắc: .claude/rules/giao-dien.md (không viết mã hex mới ngoài :root) */
  --accent-strong: #10b981;   /* viền chọn, focus trên canvas */
  --accent-line: #bdf0dc;     /* viền mint nhạt */
  --ink-3: #2a3547;
  --on-dark: #ffffff;         /* chữ / icon trên nền tối hoặc nền màu */
  --inv: #141e30; --on-inv: #ffffff; /* nhãn / thông báo đảo màu (toast, chip mặt trong…) — giao diện tối đảo lại thành nền sáng */
  --panel-2: #f9fafc;         /* nền phụ: đầu bảng, ô nổi nhẹ */
  --field: #f5f7fa;           /* nền ô nhập */
  --hover: #eef2f7;           /* di chuột lên nút / dòng */
  --glass: rgba(255, 255, 255, .94); /* thanh / bảng nổi trên khung vẽ */
  --line-strong: #c6cdd8;
  --muted-2: #94a0b2;         /* chữ phụ nhạt, icon mờ */
  --danger: #c0353d; --danger-soft: #fdecee;
  --warn: #c2410c; --warn-soft: #fff4d6; --warn-ink: #7a5a00;
  --ok: #047857;
  --sel-bg: var(--accent-soft); --sel-ink: var(--accent-ink); /* trạng thái đang chọn — một kiểu duy nhất */
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(20, 30, 48, .05), 0 6px 20px rgba(20, 30, 48, .07);
  --shadow-2: 0 12px 40px rgba(20, 30, 48, .18);
  --grad-mint: linear-gradient(150deg, #34d399 0%, #d9f99d 100%);
  --grad-lav: linear-gradient(150deg, #6aa4ff 0%, #c3cfe2 100%);
  --grad-coral: linear-gradient(150deg, #ff9a9e 0%, #fad0c4 100%);
  --grad-night: linear-gradient(160deg, #243b55 0%, #141e30 100%);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 48, .05), 0 6px 20px rgba(20, 30, 48, .07);
  --font-ui: "Reddit Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Old Standard TT", "Cormorant Garamond", Georgia, serif;
  --font-mono: ui-monospace, Consolas, monospace;
  --fz: 1.2;                  /* hệ số cỡ chữ toàn hệ thống (23/10/2026: +20%) — mọi font-size ≤ 24px viết calc(Npx * var(--fz)) */
  font-family: var(--font-ui);
  color: var(--ink);
  font-size: calc(14px * var(--fz));
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
h2 { font-size: calc(16px * var(--fz)); margin: 0; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: calc(13px * var(--fz)); margin: 0; font-weight: 700; }
[hidden] { display: none !important; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

/* ---------- Thanh trên ---------- */
.topbar { height: 58px; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; box-shadow: 0 4px 12px rgba(52, 211, 153, .35); }
.brand b { display: block; font-size: calc(16px * var(--fz)); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.brand small { display: block; font-size: calc(11px * var(--fz)); color: var(--muted); font-weight: 500; }
.crumb { color: var(--muted); font-size: calc(13px * var(--fz)); margin-left: 10px; padding-left: 16px; border-left: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 380px; }
.spacer { flex: 1; }
.icon-btn { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; width: 38px; height: 36px; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.icon-btn:hover { background: var(--field); }
.icon-btn.on { background: var(--sel-bg); color: var(--sel-ink); border-color: var(--accent-line); }

.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 14px; cursor: pointer; font-size: calc(13px * var(--fz)); font-weight: 600; white-space: nowrap; transition: .15s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { border-color: var(--line-strong); background: var(--panel-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.block { width: 100%; }
.btn.sm { padding: 5px 10px; font-size: calc(12px * var(--fz)); }
.btn.danger { color: var(--danger); }
.btn svg { flex: none; }
.link { background: none; border: 0; color: var(--accent-ink); cursor: pointer; padding: 0; font-size: calc(12px * var(--fz)); font-weight: 600; }
.caret { font-size: calc(10px * var(--fz)); opacity: .8; }

.seg { display: inline-flex; background: var(--hover); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: calc(13px * var(--fz)); font-weight: 600; color: var(--muted); transition: .15s; white-space: nowrap; }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 4px rgba(20, 30, 48, .12); }
.seg.small button { padding: 4px 9px; font-size: calc(12px * var(--fz)); }
.seg.wide { display: flex; } .seg.wide button { flex: 1; }
#sideSeg button.on[data-side="in"] { background: var(--inv); color: var(--on-inv); } /* mặt trong: cố ý tối, khớp .in-tag */
.mt8 { margin-top: 8px; }

.menu { position: relative; }
.menu-list { display: none; position: absolute; right: 0; top: calc(100% + 8px); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 40px rgba(20, 30, 48, .18); padding: 6px; width: 300px; z-index: 20; }
.menu.open .menu-list { display: block; }
.menu-list button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; border: 0; background: none; padding: 9px 12px; border-radius: 10px; cursor: pointer; text-align: left; }
.menu-list button:hover { background: var(--accent-soft); }
.menu-list small { color: var(--muted); font-size: calc(11.5px * var(--fz)); margin-top: 2px; }

/* ---------- Bố cục: thanh biểu tượng | bảng trái (đóng/mở) | khung giữa | bảng phải (đóng/mở) ---------- */
.layout { --lw: 300px; --rw: 270px; --rr: 68px; display: grid; grid-template-columns: 72px var(--lw) 1fr var(--rw) var(--rr); height: calc(100% - 58px); }
.layout.left-closed { --lw: 0px; }
.layout.right-closed { --rw: 0px; }
/* Xem Mockup 3D: không có gì để thiết kế → ẩn hẳn bảng phải */
.layout.only3d { --rw: 0px; --rr: 0px; }
.layout.only3d .rrail { display: none; }
.layout.left-closed .side.left, .layout.right-closed .side.right, .layout.only3d .side.right { padding: 0; overflow: hidden; }

.rail { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0; }
.rail button { width: 60px; border: 0; background: none; border-radius: 12px; padding: 9px 2px 7px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; color: var(--muted); font-size: calc(10.5px * var(--fz)); font-weight: 600; transition: .15s; }
.rail button svg { width: 22px; height: 22px; }
.rail button:hover { background: var(--hover); color: var(--ink); }
.rail button.on { background: var(--accent-soft); color: var(--accent-dark); }
.rail button.on.closed { background: none; color: var(--accent-dark); }

.side { overflow-y: auto; overflow-x: hidden; min-width: 0; }
.side.left { background: var(--panel); border-right: 1px solid var(--line); padding: 16px; }
.side.right { padding: 14px; background: var(--panel); border-left: 1px solid var(--line); }
.rpage { display: none; } .rpage.on { display: block; }
.rrail { border-right: 0; border-left: 1px solid var(--line); }
.rrail button { width: 58px; }
.page { display: none; } .page.on, .page.in-studio { display: block; }
.page.in-studio .page-head { display: none; } /* trong ngăn kéo Design: tiêu đề đã có ở đầu ngăn */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 8px; }
.sub-head { font-size: calc(12px * var(--fz)); font-weight: 700; color: var(--ink); margin: 16px 0 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.count { font-size: calc(11.5px * var(--fz)); color: var(--muted); font-weight: 600; }
.hint { color: var(--muted); font-size: calc(12px * var(--fz)); line-height: 1.5; margin: 8px 0 0; }
.row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.row.two { display: grid; grid-template-columns: 1fr 1fr; margin-top: 0; }
.lbl { font-size: calc(12px * var(--fz)); color: var(--muted); font-weight: 600; }

/* Thu gọn / mở rộng */
details.acc > summary { cursor: pointer; list-style: none; font-size: calc(13px * var(--fz)); font-weight: 700; display: flex; align-items: center; gap: 8px; user-select: none; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::before { content: ''; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: .15s; margin-right: 2px; }
details.acc[open] > summary::before { transform: rotate(45deg); }
details.acc .sum-right { margin-left: auto; }
.acc-body { padding-top: 10px; }
.side.left details.acc { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 14px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 11px; font-size: calc(12px * var(--fz)); font-weight: 600; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; user-select: none; transition: .15s; }
.chip.on, .chip:has(input:checked) { background: var(--sel-bg); border-color: var(--accent-line); color: var(--sel-ink); }
.chip input { display: none; }

.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tpl { border: 1.5px solid var(--line); border-radius: 12px; padding: 8px; cursor: pointer; background: var(--panel-2); text-align: left; display: flex; flex-direction: column; gap: 3px; transition: .15s; }
.tpl:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.tpl.active { border-color: var(--accent); background: var(--accent-soft); }
.tpl .thumb { height: 66px; display: flex; align-items: center; justify-content: center; color: var(--muted-2); margin-bottom: 2px; }
.tpl .thumb svg { max-width: 100%; max-height: 100%; }
.tpl.active .thumb { color: var(--ink); }
.tpl b { font-size: calc(12px * var(--fz)); line-height: 1.3; font-weight: 700; }
.tpl small { font-size: calc(10px * var(--fz)); color: var(--accent-ink); font-weight: 700; letter-spacing: .02em; }

.dim-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.params { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: calc(11.5px * var(--fz)); color: var(--muted); font-weight: 600; }
.inp { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: hidden; transition: .15s; }
.inp.short { max-width: 140px; }
.inp:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inp input { border: 0; outline: 0; width: 100%; padding: 8px 9px; background: transparent; font-weight: 600; min-width: 0; }
.inp input::placeholder { color: var(--muted-2); font-weight: 500; }
.inp .unit { font-size: calc(11px * var(--fz)); color: var(--muted); padding-right: 9px; }
.dim-grid .inp input { font-size: calc(16px * var(--fz)); font-weight: 700; }
.selects { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.selects .field { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.selects .field > label { flex: none; }
.selects select { width: 60%; }
#winParams { margin-top: 10px; }

.mat-list { display: flex; flex-direction: column; gap: 6px; }
.mat { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); border-radius: 12px; padding: 7px; cursor: pointer; background: var(--panel); text-align: left; transition: .15s; }
.mat:hover { border-color: var(--accent-line); }
.mat.active { border-color: var(--accent); background: var(--accent-soft); }
.mat canvas { width: 44px; height: 44px; border-radius: 9px; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.mat b { display: block; font-size: calc(12.5px * var(--fz)); }
.mat small { display: block; font-size: calc(11px * var(--fz)); color: var(--muted); }
.mat .th { margin-left: auto; font-size: calc(11px * var(--fz)); color: var(--muted); font-weight: 700; white-space: nowrap; }
.mat.off { opacity: .45; cursor: not-allowed; }
.mat-rec { white-space: nowrap; font-style: normal; font-size: calc(10px * var(--fz)); font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); border-radius: var(--r-pill); padding: 1px 6px; margin-left: 4px; vertical-align: 1px; }
.mat-size { margin: 2px 0 4px; }
.gsm-seg button { display: flex; flex-direction: column; align-items: center; line-height: 1.15; padding: 4px 2px; position: relative; }
.gsm-seg button small { font-size: calc(10px * var(--fz)); color: var(--muted); font-weight: 500; }
.gsm-seg button:disabled { opacity: .4; cursor: not-allowed; }
.mat-dot { position: absolute; top: 3px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tools button { border: 1.5px solid var(--line); background: var(--panel); border-radius: 12px; padding: 9px 10px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; transition: .15s; }
.tools button b { font-size: calc(12.5px * var(--fz)); } .tools button small { font-size: calc(10.5px * var(--fz)); color: var(--muted); }
.tools button.on { border-color: var(--accent); background: var(--accent-soft); }
.opt-box { margin-top: 4px; }
.citem { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--panel); }
.citem.warn { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: var(--danger-soft); }
.citem .ct { display: flex; align-items: center; gap: 6px; font-size: calc(12.5px * var(--fz)); font-weight: 700; }
.citem .ct .tag { font-size: calc(10px * var(--fz)); font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--hover); color: var(--muted); }
.citem .ct button { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--muted); }
.citem .cf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.citem .cf .inp input { padding: 5px 6px; font-size: calc(12px * var(--fz)); }
.citem .cf select { padding: 5px 6px; font-size: calc(12px * var(--fz)); }
.citem .wm { color: var(--danger); font-size: calc(11.5px * var(--fz)); margin-top: 6px; }

.stats { display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; margin: 0; font-size: calc(12.5px * var(--fz)); }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-weight: 700; text-align: right; }

/* ---------- Khung giữa ---------- */
.stage { position: relative; min-width: 0; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.views { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-height: 0; }
.views.v2d { grid-template-columns: 1fr; } .views.v2d #view3d { display: none; }
.views.v3d { grid-template-columns: 1fr; } .views.v3d #view2d { display: none; }
.view { position: relative; min-width: 0; min-height: 0; overflow: hidden; border-radius: 18px; box-shadow: var(--shadow); }
#view2d { background: var(--canvas-bg); }
#view2d canvas, #view3d canvas { display: block; }
.float { position: absolute; z-index: 3; }
.float.tr { right: 12px; top: 12px; }
.float.bc { left: 50%; bottom: 14px; transform: translateX(-50%); }
.float.topbar2 { left: 12px; right: 12px; top: 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.float.topbar2 > * { pointer-events: auto; }
.toggles { margin: 0; justify-content: flex-end; }
.toggles .chip { background: var(--glass); backdrop-filter: blur(6px); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: calc(11.5px * var(--fz)); color: var(--muted); background: var(--glass); padding: 6px 12px; border-radius: 10px; backdrop-filter: blur(6px); }
.legend i { display: inline-block; width: 18px; height: 0; vertical-align: middle; margin-right: 6px; border-top: 2px solid #ff0000; }
.legend i.crease { border-top: 2px dashed #00a651; }
.legend i.perf { border-top: 2px dashed #ff00b4; }
.legend i.bleed { border-top: 1.5px solid #00a0e9; }
.legend i.film { border-top: 1.5px dotted #8a8f99; }
.legend .in-tag { background: var(--inv); color: var(--on-inv); border-radius: 6px; padding: 1px 8px; font-weight: 600; }
.side-badge { position: absolute; z-index: 3; left: 50%; top: 56px; transform: translateX(-50%); background: var(--inv); color: var(--on-inv); font-size: calc(12px * var(--fz)); font-weight: 600; padding: 5px 12px; border-radius: 999px; }
.toolbar { display: flex; align-items: center; gap: 6px; background: var(--glass); padding: 6px 10px; border-radius: 14px; box-shadow: 0 8px 26px rgba(20, 30, 48, .16); white-space: nowrap; font-size: calc(12px * var(--fz)); color: var(--muted); }
.toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.toolbar input[type=range] { width: 120px; accent-color: var(--accent); }
.toolbar input[type=color] { width: 26px; height: 24px; border: 0; padding: 0; background: none; cursor: pointer; }
.tb { border: 0; background: none; cursor: pointer; padding: 6px 9px; border-radius: 9px; font-size: calc(13px * var(--fz)); font-weight: 600; color: var(--ink); display: inline-flex; align-items: center; gap: 5px; }
.tb:hover { background: var(--hover); }
.tb.on { background: var(--sel-bg); color: var(--sel-ink); }
.tb.chk input { accent-color: var(--accent); }
.zoomval { min-width: 46px; text-align: center; font-weight: 700; color: var(--ink); font-size: calc(12px * var(--fz)); }
.play { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); cursor: pointer; font-size: calc(11px * var(--fz)); }
.toolbar .lbl { font-size: calc(12px * var(--fz)); }

.layerbar { position: absolute; z-index: 4; transform: translate(-50%, -100%); display: flex; align-items: center; gap: 2px; background: var(--panel); border-radius: 12px; padding: 5px; box-shadow: 0 8px 26px rgba(20, 30, 48, .2); }
.layerbar button { border: 0; background: none; width: 34px; height: 32px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.layerbar button svg { width: 19px; height: 19px; }
.layerbar button:hover { background: var(--hover); }
.layerbar button.on { background: var(--accent-soft); color: var(--accent-dark); }
.layerbar button.danger:hover { background: var(--danger-soft); color: var(--danger); }
.layerbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 3px; }

.dim-input { position: absolute; z-index: 5; width: 84px; transform: translate(-50%, -50%); border: 2px solid #2f6bff; border-radius: 8px; padding: 4px 6px; font-weight: 700; text-align: center; outline: none; box-shadow: 0 6px 20px rgba(47, 107, 255, .25); }
.popover { position: absolute; z-index: 6; background: var(--panel); border-radius: 16px; box-shadow: 0 18px 40px rgba(20, 30, 48, .22); padding: 14px; }
.size-pop { right: 16px; bottom: 74px; width: 290px; }
.size-pop .dim-grid { margin-top: 0; }
.size-pop .btn.block { margin-top: 12px; }
.flap-pop { width: 330px; max-height: 70%; overflow-y: auto; }
.flap-pop h3 { margin-bottom: 4px; }
.sugg { display: flex; flex-direction: column; gap: 5px; margin: 10px 0; }
.sugg button { border: 1.5px solid var(--line); background: var(--panel); border-radius: 10px; padding: 7px 9px; text-align: left; cursor: pointer; }
.sugg button b { font-size: calc(12.5px * var(--fz)); display: block; } .sugg button small { font-size: calc(11px * var(--fz)); color: var(--muted); }
.sugg button.on { border-color: var(--accent); background: var(--accent-soft); }
.sugg button.best::after { content: 'Gợi ý'; float: right; font-size: calc(10px * var(--fz)); font-weight: 700; color: var(--on-dark); background: var(--pink); border-radius: 6px; padding: 1px 6px; margin-top: -1px; }
.flap-pop .params { margin-top: 6px; }
.flap-pop .actions { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; }
.drop-hint { position: absolute; inset: 10px; border: 2px dashed var(--accent); border-radius: 14px; background: rgba(227, 243, 236, .7); display: grid; place-items: center; font-weight: 700; color: var(--accent-dark); z-index: 7; pointer-events: none; }

/* ---------- Bảng phải ---------- */
select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 9px; background: var(--panel); outline: none; }
select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 60px; }
#faceRow { margin-top: 10px; }
.swatches { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.sw.on { box-shadow: 0 0 0 2px var(--accent); }
.sw.none { background: conic-gradient(#fff 0 25%, #e6e6e6 0 50%, #fff 0 75%, #e6e6e6 0) 0 0 / 10px 10px; }
.sw.custom { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.sw.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.gallery:empty { display: none; }
.gallery button { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--panel); cursor: pointer; }
.gallery img { width: 100%; height: 100%; object-fit: contain; }
.layers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.layers:empty::after { content: 'Chưa có lớp nào'; color: var(--muted); font-size: calc(12px * var(--fz)); }
.layers li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: calc(12.5px * var(--fz)); background: var(--panel); }
.layers li.on { border-color: var(--accent); background: var(--accent-soft); }
.layers li img { width: 28px; height: 28px; object-fit: cover; border-radius: 6px; background: var(--hover); }
.layers li .ty { width: 28px; height: 28px; border-radius: 6px; background: var(--inv); color: var(--on-inv); display: grid; place-items: center; font-weight: 800; }
.layers li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layers li button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 3px 5px; border-radius: 6px; }
.layers li button:hover { background: var(--hover); color: var(--ink); }
.editor { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); display: grid; grid-template-columns: 1fr 1fr; gap: 9px 10px; }
.editor .full { grid-column: 1 / -1; }
.editor input[type=range] { width: 100%; accent-color: var(--accent); }
.editor .inp input { padding: 6px 8px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--inv); color: var(--on-inv); padding: 10px 18px; border-radius: 12px; font-size: calc(13px * var(--fz)); opacity: 0; pointer-events: none; transition: .25s; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%); }

@media (max-width: 1350px) { .crumb { display: none; } }

/* ---------- Menu dự án, trạng thái lưu, hộp thoại ---------- */
.menu-list.left { left: 0; right: auto; width: 290px; }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.proj-name { display: flex; align-items: center; gap: 6px; padding: 6px 8px; color: var(--muted); }
.proj-name input { flex: 1; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; font-weight: 700; font-size: calc(14px * var(--fz)); outline: none; min-width: 0; }
.proj-name input:hover, .proj-name input:focus { border-color: var(--line); }
.save-state { display: flex; align-items: center; gap: 6px; font-size: calc(12px * var(--fz)); color: var(--muted); white-space: nowrap; }
.save-state.saving { color: var(--warn-ink); } .save-state.ok { color: var(--accent-dark); } .save-state.err { color: var(--danger); }
.modal { position: fixed; inset: 0; background: rgba(20, 30, 48, .35); z-index: 125; /* trên Studio (.aiw 60) và hộp Tài liệu mới / Export (.nd-wrap 120) */ display: grid; place-items: center; }
.modal-card { background: var(--panel); border-radius: 18px; width: min(920px, 92vw); max-height: 84vh; display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0, 0, 0, .25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.gcard { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel-2); display: flex; flex-direction: column; }
.gcard .gthumb { height: 130px; background: var(--hover) center / contain no-repeat; display: grid; place-items: center; color: var(--muted-2); }
.gcard .gthumb svg { max-width: 90%; max-height: 90%; }
.gcard .gmeta { padding: 8px 10px; font-size: calc(12px * var(--fz)); }
.gcard .gmeta b { display: block; font-size: calc(13px * var(--fz)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcard .gmeta small { color: var(--muted); }
.gcard .gact { display: flex; gap: 6px; padding: 0 10px 10px; flex-wrap: wrap; }
.gcard.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.empty { color: var(--muted); font-size: calc(13px * var(--fz)); padding: 20px 0; text-align: center; }
.tpl .del { position: absolute; top: 4px; right: 4px; border: 0; background: var(--glass); border-radius: 6px; cursor: pointer; color: var(--muted); font-size: calc(11px * var(--fz)); padding: 2px 5px; }
.tpl { position: relative; }

/* ---------- Thư viện tai trong hộp mở rộng cạnh ---------- */
.flap-pop { right: 12px; top: 56px; width: min(390px, calc(100% - 24px)); max-height: calc(100% - 140px); overflow-y: auto; }
.lib-group { font-size: calc(11px * var(--fz)); font-weight: 700; color: var(--muted); margin: 10px 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.lib { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.lib button { border: 1.5px solid var(--line); background: var(--panel); border-radius: 10px; padding: 4px 4px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ink); }
.lib button small { font-size: calc(10.5px * var(--fz)); line-height: 1.25; text-align: center; }
.lib button.on { border-color: var(--accent); background: var(--accent-soft); }
.lib button.best { border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.why { font-size: calc(11.5px * var(--fz)); color: var(--accent-dark); background: var(--accent-soft); border-radius: 8px; padding: 6px 8px; margin-top: 8px; }
.angle-row { display: flex; align-items: center; gap: 8px; }
.angle-row input[type=range] { flex: 1; accent-color: var(--accent); }
.quick { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.quick button { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 3px 8px; cursor: pointer; font-size: calc(12px * var(--fz)); font-weight: 600; }
.quick button.on { background: var(--sel-bg); color: var(--sel-ink); border-color: var(--accent-line); }
.ref-box { margin-top: 0 !important; border-top: 0 !important; padding-top: 0 !important; }
.legend i { border-top-color: var(--c, #000) !important; }

/* ---------- Thanh tác vụ chi tiết, thanh vẽ, danh sách gọn ---------- */
.itembar { position: absolute; z-index: 5; transform: translate(-50%, -100%); display: flex; align-items: center; gap: 3px; background: var(--panel); border-radius: 12px; padding: 5px 7px; box-shadow: 0 8px 26px rgba(20, 30, 48, .22); white-space: nowrap; font-size: calc(12px * var(--fz)); }
.itembar.below, .layerbar.below { transform: translate(-50%, 0); }
.itembar button { border: 0; background: none; border-radius: 7px; padding: 5px 7px; cursor: pointer; font-weight: 600; font-size: calc(12px * var(--fz)); color: var(--ink); }
.itembar button:hover { background: var(--hover); }
.itembar button.on { background: var(--sel-bg); color: var(--sel-ink); }
.itembar button.danger:hover { background: var(--danger-soft); }
.itembar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 3px; }
.itembar .lbl { color: var(--muted); font-weight: 600; margin: 0 2px 0 4px; }
.itembar .ttl { margin-right: 6px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.itembar input.mini { width: 56px; border: 1px solid var(--line); border-radius: 7px; padding: 4px 5px; font-weight: 700; font-size: calc(12px * var(--fz)); outline: none; }
.itembar input.mini:focus { border-color: var(--accent); }
.draftbar { position: absolute; z-index: 5; left: 50%; bottom: 70px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; background: var(--inv); color: var(--on-inv); border-radius: 12px; padding: 6px 8px 6px 14px; box-shadow: 0 8px 26px rgba(20, 30, 48, .3); font-size: calc(12.5px * var(--fz)); }
.draftbar .btn { border: 0; }
.draftbar kbd { font: inherit; font-size: calc(10.5px * var(--fz)); opacity: .7; margin-left: 4px; }
.lib.compact { grid-template-columns: repeat(4, 1fr); gap: 4px; }
.lib.compact button { padding: 3px 2px 4px; }
.lib.compact button svg { width: 44px; height: 32px; }
.lib.compact button small { font-size: calc(9.5px * var(--fz)); }
.tools { grid-template-columns: 1fr 1fr; }
.tools button { padding: 8px 10px; }
.layers li button.locked { color: var(--ink); }
.menu-list button b { font-weight: 600; }
.itembar select.mini { width: auto; max-width: 150px; padding: 4px 6px; font-size: calc(12px * var(--fz)); font-weight: 600; border-radius: 7px; }
.tools { grid-template-columns: 1fr 1fr; }
.field label small { color: var(--muted); font-weight: 500; }

/* Thứ tự gấp */
.seq-acts { display: inline-flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.sub-head.row-between:has(#seqAuto) { flex-wrap: wrap; row-gap: 4px; }
.sub-head.row-between:has(#seqAuto) .seq-acts { width: 100%; justify-content: flex-start; }
#seqAuto { font-weight: 700; }
.seq-list { display: flex; flex-direction: column; max-height: 340px; overflow-y: auto; margin-top: 6px; }
.seq-step.drop, .seq-gap.drop { border-color: var(--accent); background: var(--accent-soft); }
.seq-head:hover { color: var(--ink); }
.seq-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 7px; font-size: calc(12px * var(--fz)); cursor: grab; }
.seq-row:hover { background: var(--field); }
.seq-row.on { background: var(--accent-soft); }
.seq-row.dragging { opacity: .4; }
.seq-row .grip { color: var(--muted); }
.seq-row .nm { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seq-row .val { color: var(--muted); font-size: calc(11px * var(--fz)); }
.seq-row button:hover { background: var(--line); color: var(--ink); }
.seq-gap { height: 8px; border: 1px dashed transparent; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: calc(10.5px * var(--fz)); color: transparent; transition: height .12s; }
.seq-list.dragging .seq-gap { height: 22px; border-color: var(--line); color: var(--muted); }

/* Nhập dieline */
.imp-btns { margin-left: auto; display: inline-flex; gap: 10px; font-size: calc(12px * var(--fz)); }
.imp { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; min-height: 60vh; }
.imp-view { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#impCv { width: 100%; flex: 1; min-height: 380px; background: var(--field); border-radius: 12px; cursor: crosshair; }
.imp-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: calc(11.5px * var(--fz)); color: var(--muted); }
.imp-legend i { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--c); vertical-align: middle; margin-right: 5px; }
.imp-legend i.dash { border-top-style: dashed; }
.imp-legend i.fill { height: 9px; border: 0; background: var(--c); opacity: .5; border-radius: 2px; }
.imp-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.imp-side select, .imp-side input { width: 100%; }
.imp-row { display: flex; justify-content: space-between; font-size: calc(12.5px * var(--fz)); padding: 2px 0; }
.imp-row span { color: var(--muted); }
.imp-groups { display: flex; flex-direction: column; gap: 4px; max-height: 240px; overflow-y: auto; }
.imp-g { display: grid; grid-template-columns: 18px minmax(0, 1fr) 118px; gap: 6px; align-items: center; font-size: calc(12px * var(--fz)); }
.imp-g i { width: 16px; height: 0; border-top: 3px solid var(--c); }
.imp-g i.dash { border-top-style: dashed; }
.imp-g .nm { min-width: 0; display: flex; flex-direction: column; }
.imp-g .nm b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-g .nm small, .muted-s { color: var(--muted); font-weight: 500; font-size: calc(11px * var(--fz)); }
.imp-g select { font-size: calc(12px * var(--fz)); padding: 3px 4px; }
.imp-stats { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 4px; }
.warn-t { color: var(--warn); font-size: calc(12px * var(--fz)); margin: 4px 0; }
@media (max-width: 760px) { .imp { grid-template-columns: 1fr; } }

/* Nhập hàng loạt */
.inbox { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.inbox-s { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.inbox-h { display: flex; justify-content: space-between; gap: 10px; font-size: calc(13px * var(--fz)); margin-bottom: 4px; }
.inbox-h span { color: var(--muted); font-size: calc(12px * var(--fz)); }
.inbox-r { display: grid; grid-template-columns: 22px minmax(140px, 1.2fr) minmax(0, 2fr) auto auto; gap: 8px; align-items: center; font-size: calc(12px * var(--fz)); padding: 4px 0; border-top: 1px dashed var(--line); }
.inbox-r .fn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.inbox-r .fn small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.inbox-r .inf { display: flex; gap: 8px; align-items: center; min-width: 0; }
.inbox-r .tag { background: var(--accent-soft); color: var(--accent-dark); border-radius: 6px; padding: 1px 6px; font-size: calc(11px * var(--fz)); }
.inbox-foot { position: sticky; bottom: -16px; background: var(--panel); display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0 4px; margin-top: 8px; border-top: 1px solid var(--line); }
.inbox-empty pre { background: var(--field); border-radius: 10px; padding: 10px 12px; font-size: calc(12px * var(--fz)); }
/* Tham chiếu gấp 3D */
.float.bl { left: 12px; bottom: 70px; }
.ref-panel { width: min(380px, calc(100% - 24px)); background: var(--glass); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.ref-head { display: flex; gap: 6px; }
.ref-head select { flex: 1; min-width: 0; font-size: calc(12px * var(--fz)); }
.ref-media video, .ref-media img { width: 100%; max-height: 240px; object-fit: contain; background: #111; border-radius: 8px; display: block; }
.ref-media input[type=range] { width: 100%; }
.ref-media a { font-size: calc(12px * var(--fz)); word-break: break-all; }
.ref-ctl { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: calc(12px * var(--fz)); }
.ref-ctl[hidden] { display: none; }
.ref-marks { color: var(--muted); font-size: calc(11px * var(--fz)); width: 100%; }
#btnRef.on { background: var(--accent-soft); color: var(--accent-dark); }

/* Kiểm tra nguyên tắc */
.rule-list { display: flex; flex-direction: column; gap: 3px; max-height: 220px; overflow-y: auto; margin-top: 4px; }
.rule-list:empty { display: none; }
.rule { display: flex; gap: 6px; font-size: calc(12px * var(--fz)); line-height: 1.35; padding: 5px 7px; border-radius: 8px; cursor: pointer; }
.rule:hover { filter: brightness(.97); }
.rule b { flex: none; font-size: calc(10.5px * var(--fz)); padding: 1px 5px; border-radius: 5px; height: fit-content; }
.rule.error { background: var(--danger-soft); } .rule.error b { background: var(--danger); color: var(--on-dark); }
.rule.warn { background: var(--warn-soft); } .rule.warn b { background: var(--warn); color: var(--on-dark); }
.rule.info { background: var(--panel-2); color: var(--muted); } .rule.info b { background: var(--muted-2); color: var(--on-dark); }
.rule.ok { background: var(--accent-soft); } .rule.ok b { background: var(--accent-strong); color: var(--on-dark); }
.count.bad { color: var(--danger); }
.rules-help h3 { font-size: calc(14px * var(--fz)); margin: 14px 0 6px; }
.rules-help li { font-size: calc(13px * var(--fz)); line-height: 1.55; margin-bottom: 4px; }

.model-info { font-size: calc(12px * var(--fz)); line-height: 1.6; color: var(--muted); margin-top: 8px; }
.model-info:empty { display: none; }
.model-info span { color: var(--ink); font-weight: 600; }

/* Góc nhìn 3D có sẵn: thanh dọc mép phải */
.float.mr { right: 12px; top: 50%; transform: translateY(-50%); }
.toolbar.vert { flex-direction: column; padding: 5px; gap: 2px; }
.cam-views .tb svg.ic { width: 30px; height: 30px; }
.cam-views .tb { min-width: 44px; min-height: 42px; padding: 6px 7px; font-size: calc(11.5px * var(--fz)); font-weight: 600; color: var(--muted); width: 100%; justify-content: center; }
.cam-views .tb:hover { color: var(--ink); }

/* Mở rộng cạnh: bảng gợi ý hiện cạnh cạnh đang chọn */
.edge-picker { position: absolute; z-index: 6; width: 360px; max-height: min(460px, calc(100% - 120px)); display: flex; flex-direction: column; background: var(--panel); border-radius: 16px; box-shadow: 0 14px 40px rgba(20, 30, 48, .24); overflow: hidden; }
.edge-picker .ep-head { display: flex; align-items: flex-start; gap: 8px; padding: 12px 12px 8px 14px; border-bottom: 1px solid var(--line); }
.edge-picker .ep-head > div { flex: 1; min-width: 0; }
.edge-picker .ep-head b { display: block; font-size: calc(13px * var(--fz)); }
.edge-picker .ep-head small { color: var(--muted); font-size: calc(11.5px * var(--fz)); }
.edge-picker .ep-body { overflow: auto; padding: 4px 12px 12px; }
.edge-picker .ep-sec { font-size: calc(11px * var(--fz)); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 10px 0 6px; }
.edge-picker .ep-top { display: grid; gap: 6px; }
.edge-picker .ep-cols { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.edge-picker .ep-cols .chip { font-size: calc(11.5px * var(--fz)); padding: 4px 9px; }
.edge-picker .ep-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ep-card { border: 1.5px solid var(--line); background: var(--panel); border-radius: 10px; padding: 5px 4px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--ink); text-align: center; font: inherit; }
.ep-card b { font-size: calc(10.5px * var(--fz)); font-weight: 600; line-height: 1.25; display: block; }
.ep-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.ep-card.wide { flex-direction: row; text-align: left; gap: 10px; padding: 6px 10px 6px 6px; border-color: var(--accent-line); }
.ep-card.wide b { font-size: calc(12.5px * var(--fz)); }
.ep-card.wide small { display: block; font-size: calc(11px * var(--fz)); color: var(--muted); line-height: 1.35; margin-top: 2px; }
.ep-card svg { flex: none; color: var(--ink); }
ol.steps { margin: 6px 0 0; padding-left: 18px; font-size: calc(12px * var(--fz)); color: var(--muted); line-height: 1.5; }
ol.steps li { margin-bottom: 6px; }
ol.steps b { color: var(--ink); }

/* Bố cục trải: 8 cách xếp dải thân */

/* Biến thể: tab trên khung giữa */
.variant-bar { display: flex; align-items: center; gap: 6px; min-height: 40px; overflow-x: auto; scrollbar-width: thin; }
.vtab { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); background: var(--panel); border-radius: 12px; padding: 5px 6px 5px 12px; cursor: pointer; white-space: nowrap; color: var(--ink); font: inherit; max-width: 260px; }
.vtab .vt { display: flex; flex-direction: column; line-height: 1.2; text-align: left; min-width: 0; }
.vtab .vt b { font-size: calc(12.5px * var(--fz)); overflow: hidden; text-overflow: ellipsis; }
.vtab .vt small { font-size: calc(11px * var(--fz)); color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.vtab .vx { border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 7px; padding: 2px 6px; font-size: calc(12px * var(--fz)); }
.vtab .vx:hover { background: var(--hover); color: var(--danger); }
.vtab:hover { border-color: var(--accent-line); }
.vtab.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 2px 10px rgba(52, 211, 153, .15); }
.vtab.add { padding: 7px 12px; color: var(--accent-dark); font-weight: 700; font-size: calc(12.5px * var(--fz)); border-style: dashed; }
.variant-bar .vspace { flex: 1; }
.variant-bar .btn.sm { white-space: nowrap; }

/* Gói & mã mở khoá */
.plan-badge { display: inline-flex; align-items: center; gap: 5px; border: 1.5px solid color-mix(in srgb, var(--danger) 28%, transparent); background: var(--danger-soft); color: var(--danger); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: calc(12px * var(--fz)); font-weight: 700; cursor: pointer; margin-right: 8px; white-space: nowrap; }
.plan-badge.pro { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-dark); }
.menu-list .exp-note { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; background: var(--warn-soft); color: var(--warn-ink); }
.menu-list .exp-note:hover { background: var(--warn-soft); filter: brightness(.97); }
.menu-list .exp-note small { grid-column: 2; color: var(--warn-ink); opacity: .85; }
/* Nhãn tính năng trả phí (Cơ bản / Pro): màu tím lavender riêng — khác màu nhấn xanh bạc hà, nhận ra ngay ở mọi nơi (giao-dien.md: màu phụ dùng cho huy hiệu) */
.paid-tag { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; font-style: normal; font-size: calc(11px * var(--fz)); font-weight: 700; color: var(--lav-ink); background: color-mix(in srgb, var(--lav) 26%, transparent); border-radius: var(--r-pill); padding: 1px 7px; vertical-align: 1px; }
.plan-badge.trial { border-color: color-mix(in srgb, var(--lav-ink) 40%, transparent); background: var(--lav-soft); color: var(--lav-ink); }
.plan-badge.soon { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-soft); color: var(--warn-ink); }
.plans .code-row { display: flex; gap: 8px; margin: 12px 0 4px; }
/* Hộp mở khoá / nâng cấp trong app: thẻ gói như trang Bảng giá */
.up-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 16px 0 6px; }
.up-plan { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 8px; padding: 26px 18px 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); box-shadow: var(--shadow-1); }
.up-plan.pop { border: 2px solid var(--accent); box-shadow: 0 18px 44px color-mix(in srgb, var(--accent) 22%, transparent); }
/* Dải màu đầu thẻ như trang Bảng giá: Cơ bản lavender, Pro tháng midnight, Pro năm / mua lẻ mint */
.up-plan::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--grad-mint); }
.up-plan.k-basic::before { background: var(--grad-lav); } .up-plan.k-month::before { background: var(--grad-night); }
:root[data-theme="dark"] .up-plan.k-month::before { background: linear-gradient(90deg, var(--ink-2), var(--lav)); }
.up-plan .tag { position: absolute; top: 16px; right: 14px; background: var(--grad-lav); color: var(--ink); font-size: calc(11.5px * var(--fz)); font-weight: 700; padding: 2px 10px; border-radius: var(--r-pill); }
.up-plan.pop h4 { padding-right: 100px; }
.up-plan h4 { margin: 0; font-size: calc(15px * var(--fz)); font-weight: 700; }
.up-plan .who { margin: -4px 0 0; color: var(--muted); font-size: calc(12.5px * var(--fz)); line-height: 1.4; min-height: 2.8em; }
.up-plan .price { font-size: calc(24px * var(--fz)); font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.up-plan .price small { font-size: calc(12.5px * var(--fz)); font-weight: 600; color: var(--muted); letter-spacing: 0; } .up-plan .price small.pm { display: block; margin-top: 2px; }
.up-plan ul { list-style: none; margin: 2px 0 6px; padding: 0; display: flex; flex-direction: column; gap: 6px; flex: 1; font-size: calc(12.5px * var(--fz)); line-height: 1.4; }
.up-plan li { display: flex; gap: 7px; align-items: flex-start; } .up-plan li svg { flex: none; margin-top: 2px; color: var(--accent-ink); }
.up-plan .btn { margin-top: auto; }
.up-foot { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-top: 10px; } .up-foot .hint { margin: 0; } .up-foot a { color: var(--accent-ink); font-size: calc(13px * var(--fz)); font-weight: 600; white-space: nowrap; display: inline-flex; gap: 4px; align-items: center; }
.up-code { margin-top: 8px; } .up-code summary { cursor: pointer; color: var(--muted); font-size: calc(13px * var(--fz)); width: max-content; } .up-code[open] summary { margin-bottom: 4px; }
.ai-save { margin-right: 10px; }
.plans .code-row input { flex: 1; font: inherit; font-size: calc(15px * var(--fz)); letter-spacing: .06em; text-transform: uppercase; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 12px; }
.plan { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; color: inherit; text-decoration: none; }
a.plan:hover { border-color: var(--accent); background: var(--sel-bg); }
.plans .btn.block.primary { margin-top: 10px; }
.plan b { font-size: calc(13px * var(--fz)); } .plan .price { font-size: calc(16px * var(--fz)); font-weight: 800; color: var(--ink); }
.plan small { font-size: calc(11.5px * var(--fz)); color: var(--muted); line-height: 1.35; }
.plan.pro { border-color: var(--accent-line); } .plan.biz { border-color: color-mix(in srgb, var(--lav-ink) 40%, transparent); background: var(--lav-soft); }

/* Xuất hàng loạt */
.batch textarea { width: 100%; font: calc(13px * var(--fz))/1.6 var(--font-mono); padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; resize: vertical; box-sizing: border-box; }
.batch .row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.batch .chip input { display: none; }


/* Kiểu dàn: thẻ có ảnh lưới ghi tên mặt */
.layout-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.net-card { border: 1.5px solid var(--line); background: var(--panel); border-radius: 12px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: var(--ink); }
.net-card:hover { border-color: var(--accent-line); }
.net-card.on { border-color: var(--accent); background: var(--accent-soft); }
.net-card .net-img { height: 78px; display: flex; align-items: center; justify-content: center; }
.net-card .net-img svg { width: 100%; height: 100%; }
.net-card b { font-size: calc(11.5px * var(--fz)); display: block; }
.net-card i { font-style: normal; font-size: calc(10px * var(--fz)); font-weight: 700; color: var(--on-accent); background: var(--accent); border-radius: 6px; padding: 1px 6px; margin-left: 4px; }
.net-card small { display: none; }
.net-pick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 10px; }
.net-pick-grid .net-card { padding: 10px; }
.net-pick-grid .net-card .net-img { height: 150px; }
.net-pick-grid .net-card b { font-size: calc(13.5px * var(--fz)); display: inline; }
.net-pick-grid .net-card small { display: block; font-size: calc(11.5px * var(--fz)); color: var(--muted); margin-top: 3px; }

/* Chèn: chữ, hình khối */
.ins-text { display: grid; gap: 6px; }
.ins-t { border: 1.5px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 12px; text-align: left; cursor: pointer; color: var(--ink); font-family: var(--font-ui); }
.ins-t:hover { border-color: var(--accent); background: var(--accent-soft); }
.ins-t.t1 { font-size: calc(18px * var(--fz)); font-weight: 800; } .ins-t.t2 { font-size: calc(14px * var(--fz)); font-weight: 700; } .ins-t.t3 { font-size: calc(12px * var(--fz)); }
.shape-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.shape-grid button { aspect-ratio: 1; border: 1.5px solid var(--line); background: var(--panel); border-radius: 10px; cursor: pointer; color: var(--ink); display: grid; place-items: center; padding: 6px; }
.shape-grid button:hover { border-color: var(--accent); background: var(--accent-soft); }
.shape-grid svg { width: 100%; height: 100%; }
[data-pen].on { background: var(--accent-soft); border-color: var(--accent); }
.layers li .ty.sh { font-size: calc(14px * var(--fz)); }
.editor .colorrow { display: flex; align-items: center; gap: 6px; }
.editor .colorrow input[type=color] { width: 34px; height: 28px; border: 1px solid var(--line); border-radius: 8px; padding: 0; background: none; }
.editor .colorrow .chip { padding: 3px 8px; font-size: calc(11px * var(--fz)); }

/* Thẻ mẫu: dieline + ảnh 3D */
@keyframes shimmer { to { background-position: -200% 0; } }

/* Bát giác: sơ đồ cạnh + bảng số đo gấp */
.octa-info { display: flex; gap: 10px; align-items: center; font-size: calc(12px * var(--fz)); margin-top: 8px; }
.octa-map { width: 110px; flex: none; }
.octa-tb { width: 100%; border-collapse: collapse; font-size: calc(11.5px * var(--fz)); margin-top: 8px; }
.octa-tb th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px; border-bottom: 1px solid var(--line); }
.octa-tb td { padding: 5px 4px; border-bottom: 1px dashed var(--line); vertical-align: top; }
.octa-tb td:first-child { font-weight: 700; white-space: nowrap; }
.octa-tb tr.bd td:first-child { color: var(--muted); }
.octa-tb small { color: var(--muted); }
.field input:disabled { background: var(--panel-2); color: var(--lav-ink); font-weight: 700; }

/* Lớp gắn theo mặt */
.face-layers { margin-top: 10px; }
.face-layers .fl-head { display: flex; justify-content: space-between; align-items: center; font-size: calc(12px * var(--fz)); font-weight: 700; margin-bottom: 6px; }
.face-layers .fl-head small { color: var(--muted); font-weight: 500; }
.fl-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 4px; cursor: pointer; font-size: calc(12px * var(--fz)); }
.fl-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.fl-row small { color: var(--muted); }
.fl-row button { border: 0; background: none; color: var(--muted); cursor: pointer; }
.fl-row button:hover { color: var(--danger); }
.fl-row:hover, .fl-row.on { border-color: var(--accent); background: var(--accent-soft); }
.link.danger { color: var(--danger); }

/* ---------- Công cụ dạng icon (Tự dựng khuôn) ---------- */
.tools.icons { grid-template-columns: repeat(5, 1fr); gap: 5px; }
.tools.icons button { position: relative; align-items: center; justify-content: center; padding: 8px 0 6px; border-radius: 11px; }
.tools.icons button svg { width: 22px; height: 22px; color: var(--ink); }
.tools.icons button kbd { position: absolute; right: 3px; bottom: 2px; font: 600 calc(9px * var(--fz))/1 inherit; color: var(--muted); background: none; border: 0; padding: 0; }
.tools.icons button.on svg { color: var(--accent-ink, var(--ink)); }
.chips.icon-chips { gap: 5px; margin-bottom: 6px; }
.chip.ico { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; }
.chip.ico svg { flex: none; }
.chip.ico span { font-size: calc(12px * var(--fz)); }
.chip.ico.on svg path, .chip.ico.on svg polygon { stroke: currentColor; }
i.info { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; border: 1.3px solid var(--muted); color: var(--muted); font: 700 calc(9px * var(--fz))/1 var(--font-display); font-style: italic; cursor: help; vertical-align: 1px; }
kbd { font: 600 calc(10.5px * var(--fz))/1 var(--font-mono); background: var(--hover); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 4px; }
.itembar { flex-wrap: wrap; justify-content: center; max-width: min(820px, calc(100% - 16px)); }
.itembar select.mini { border: 1px solid var(--line); border-radius: 7px; padding: 3px 4px; font-weight: 600; font-size: calc(12px * var(--fz)); }

/* ---------- Lớp: ẩn/hiện, kéo thả, nhãn hiệu ứng ---------- */
.layers li .vis { padding: 2px 3px; color: var(--ink); }
.layers li.off { opacity: .55; }
.layers li.off img, .layers li.off .ty { filter: grayscale(1); }
.layers li span small.ltag { display: block; font-size: calc(10px * var(--fz)); color: var(--accent-ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.layers li.dragging { opacity: .4; }
.layers li.drop-above { box-shadow: 0 -3px 0 var(--accent); }
.layers li.drop-below { box-shadow: 0 3px 0 var(--accent); }
details.sub-acc { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; background: var(--panel); }
details.sub-acc > .editor { margin-top: 8px; border: 0; padding: 0; background: none; }
details.sub-acc i.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }
.editor select { width: 100%; }
.fx-chips { margin: 0; gap: 5px; }
.fx-chips .chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; font-size: calc(11.5px * var(--fz)); }
.foil-sw { width: 13px; height: 13px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0,0,0,.15); }
.foil-gold { background: linear-gradient(135deg, #7d5a14, #fff1a8, #c99a2e); }
.foil-silver { background: linear-gradient(135deg, #6c727a, #fff, #b9bfc6); }
.foil-copper { background: linear-gradient(135deg, #6d3418, #ffd0ad, #b8653a); }
.foil-rose { background: linear-gradient(135deg, #86554f, #fff0e9, #d29a8d); }
.foil-holo { background: conic-gradient(#ff8fd8, #9fd8ff, #c6ffcf, #fff6a8, #ffb4a1, #ff8fd8); }
.sub-head.mat-group { margin-top: 10px; }

/* ---------- Bảng phím tắt ---------- */
.kbd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px 22px; }
.kbd-grid h4 { margin: 0 0 6px; font-size: calc(13px * var(--fz)); }
.kbd-row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: calc(12px * var(--fz)); }
.kbd-row small { color: var(--muted); text-align: right; }

/* ---------- Kho ảnh ---------- */
.gal-search { width: 100%; margin-top: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px; font: inherit; font-size: calc(12px * var(--fz)); outline: none; }
.gal-search:focus { border-color: var(--accent); }
.gallery { max-height: 260px; overflow-y: auto; }
.gal-item { position: relative; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff repeating-conic-gradient(var(--hover) 0 25%, #fff 0 50%) 0 0 / 10px 10px; cursor: grab; }
.gal-item:hover { border-color: var(--accent); }
.gal-item img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.gal-del { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: rgba(20, 30, 48,.75); color: var(--on-dark); font-size: calc(10px * var(--fz)); line-height: 18px; padding: 0; cursor: pointer; display: none; }
.gal-item:hover .gal-del { display: block; }

/* ---------- Quy trình khép kín 1 → 2 → 3 (thanh trên) ---------- */
.flow { list-style: none; display: flex; gap: 2px; margin: 0 6px 0 0; padding: 3px; background: var(--hover); border-radius: 11px; }
.flow li { display: flex; align-items: center; gap: 6px; padding: 5px 11px 5px 6px; border-radius: 8px; font-size: calc(12.5px * var(--fz)); font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.flow li i { font-style: normal; width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; font-size: calc(11px * var(--fz)); background: var(--hover); color: var(--ink); }
.flow li:hover { color: var(--ink); }
.flow li.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 4px rgba(20, 30, 48, .12); }
.flow li.on i { background: var(--accent); color: var(--on-accent); }
.flow li[data-flow="design"] i { background: var(--pink); color: var(--on-dark); }
.tb.accent { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }


/* ---------- Icon chung (js/icons.js) ---------- */
svg.ic { width: 18px; height: 18px; flex: none; overflow: visible; vertical-align: -4px; }
.btn svg.ic, .tb svg.ic, .itembar button svg.ic, .ins-t svg.ic { width: 16px; height: 16px; }
.tb, .itembar button, .layerbar button, .btn { gap: 6px; }
.tb { display: inline-flex; align-items: center; }
.icon-btn svg, .icon-btn svg.ic { width: 18px; height: 18px; }
.shape-grid svg.ic { width: 26px; height: 26px; }
.layerbar button svg, .layerbar button svg.ic { width: 18px; height: 18px; }
.layers li button svg.ic, .fl-row button svg.ic, .gal-del svg.ic, .vx svg.ic, .tpl .del svg.ic { width: 13px; height: 13px; vertical-align: -2px; }
.layers li .ty.sh svg.ic { width: 16px; height: 16px; }
.seq-row .grip svg.ic { width: 15px; height: 15px; vertical-align: -3px; }
.play svg.ic { width: 16px; height: 16px; vertical-align: -3px; }
.ep-sec svg.ic { width: 14px; height: 14px; color: var(--accent-ink); vertical-align: -2px; }
.caret svg.ic, .btn .ic + .ic { width: 12px; height: 12px; }

/* ---------- Logo = nút Trang chủ, bước quy trình gộp, tab tài liệu (như Illustrator) ---------- */
.brand-btn { border: 0; background: none; padding: 4px 8px 4px 4px; border-radius: 12px; cursor: pointer; color: inherit; font: inherit; text-align: left; }
.brand-btn:hover { background: var(--hover); }
.menu-list button:has(kbd) { flex-direction: row; justify-content: space-between; align-items: center; }
.menu-list kbd { font: 600 calc(11px * var(--fz))/1 var(--font-ui); color: var(--muted); background: var(--hover); border-radius: 6px; padding: 4px 6px; }
.toast { z-index: 300; }
.doctabs { display: flex; align-items: flex-end; gap: 3px; margin: -12px -12px 0; padding: 6px 12px 0; border-bottom: 1px solid var(--line); background: var(--hover); min-height: 40px; overflow-x: auto; scrollbar-width: none; flex: none; }
.dtab { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 6px 0 10px; border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0; cursor: pointer; color: var(--muted); max-width: 230px; min-width: 120px; white-space: nowrap; flex: none; transition: background .15s; }
.dtab:hover { background: var(--field); color: var(--ink); }
.dtab.on { background: var(--bg); border-color: var(--line); color: var(--ink); margin-bottom: -1px; height: 35px; box-shadow: inset 0 2px 0 var(--accent); }
.dtab > .ic { flex: none; opacity: .7; }
.dtab.on > .ic { color: var(--accent-ink); opacity: 1; }
.dt-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; flex: 1; }
.dt-t b { font-size: calc(12.5px * var(--fz)); overflow: hidden; text-overflow: ellipsis; }
.dt-t small { font-size: calc(10.5px * var(--fz)); color: var(--muted); font-weight: 600; }
.dtab .dx { border: 0; background: none; color: var(--muted); border-radius: 6px; width: 22px; height: 22px; display: grid; place-items: center; cursor: pointer; flex: none; opacity: .6; }
.dtab:hover .dx, .dtab.on .dx { opacity: 1; }
.dtab .dx:hover { background: var(--line); color: var(--danger); }
.dtab-add { border: 0; background: none; width: 30px; height: 30px; margin-bottom: 3px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--muted); flex: none; }
.dtab-add:hover { background: var(--field); color: var(--accent-dark); }

/* ---------- Trang chủ ---------- */
.home { position: fixed; inset: 0; z-index: 80; display: grid; grid-template-columns: 252px 1fr; background: var(--panel); color: var(--ink); }
.h-side { display: flex; flex-direction: column; gap: 8px; padding: 16px 14px; border-right: 1px solid var(--line); background: var(--panel); min-height: 0; }
.h-brand { display: flex; align-items: center; gap: 10px; padding: 2px 4px 10px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: var(--r-md); }
.h-brand:hover { background: var(--hover); }
.h-brand .logo { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; box-shadow: 0 4px 12px rgba(52, 211, 153, .35); }
.h-brand b { display: block; font-size: calc(17px * var(--fz)); font-weight: 800; letter-spacing: -.02em; }
.h-brand small { display: block; font-size: calc(11px * var(--fz)); color: var(--muted); }
.btn.block { width: 100%; }
.h-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; overflow-y: auto; flex: 1; }
.h-nav hr { border: 0; border-top: 1px solid var(--line); margin: 8px 6px; width: calc(100% - 12px); }
.h-nav button { display: flex; align-items: center; gap: 12px; border: 1.5px solid transparent; background: none; padding: 10px 12px; border-radius: 12px; cursor: pointer; font-size: calc(14px * var(--fz)); font-weight: 600; color: var(--ink); text-align: left; }
.h-nav button:hover { background: var(--field); }
.h-nav button.on { border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); background: var(--panel); }
.h-me { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--panel); padding: 10px 12px; cursor: pointer; text-align: left; box-shadow: 2px 3px 0 var(--ink); }
.h-me span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.h-me b { font-size: calc(13.5px * var(--fz)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-plan { align-self: flex-start; font-size: calc(11px * var(--fz)); font-weight: 700; color: var(--c-acct); border: 1px solid color-mix(in srgb, var(--c-acct) 45%, transparent); border-radius: 6px; padding: 0 6px; }
.h-plan.pro { color: var(--accent-dark); border-color: var(--accent-line); background: var(--accent-soft); }
.h-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); }
.h-top { display: flex; align-items: center; gap: 12px; padding: 14px 32px; border-bottom: 1px solid var(--line); }
.h-top .sp, .h-sec .sp { flex: 1; }
.h-search { display: flex; align-items: center; gap: 8px; background: var(--field); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; width: min(460px, 50vw); height: 40px; color: var(--muted); }
.h-search input { border: 0; background: none; outline: none; flex: 1; font-size: calc(14px * var(--fz)); color: var(--ink); }
.h-top kbd { font: 600 calc(11px * var(--fz))/1 var(--font-ui); color: var(--muted); background: var(--hover); border-radius: 6px; padding: 3px 5px; }
.h-body { flex: 1; overflow-y: auto; padding: 26px 32px 48px; }
.h-body h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 18px; }
.h-crumb { font-size: inherit; font-weight: 600; color: var(--muted); }
.h-sub { color: var(--muted); margin: -8px 0 16px; max-width: 760px; }
.h-sec { display: flex; align-items: center; gap: 12px; margin: 28px 0 14px; }
.h-sec h2 { font-size: calc(18px * var(--fz)); }
.h-quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; max-width: 980px; }
.h-qa { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center; text-align: left; border: 1.5px solid var(--line); background: var(--panel); border-radius: 16px; padding: 16px 18px; cursor: pointer; transition: .15s; font: inherit; color: var(--ink); }
.h-qa .ic { grid-row: span 2; color: var(--accent-ink); }
.h-qa b { font-size: calc(15px * var(--fz)); } .h-qa small { color: var(--muted); }
.h-qa:hover { border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.h-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.h-tpl { position: relative; display: flex; flex-direction: column; gap: 3px; border: 1.5px solid var(--line); background: var(--panel); border-radius: 14px; padding: 8px 8px 12px; cursor: pointer; text-align: left; color: var(--ink); font: inherit; transition: .15s; }
.h-tpl:hover { border-color: var(--accent); box-shadow: 0 6px 20px rgba(20, 30, 48, .08); }
.h-tthumb { aspect-ratio: 4 / 3; border-radius: 10px; background: linear-gradient(var(--field), var(--line)); display: grid; place-items: center; overflow: hidden; margin-bottom: 6px; }
.h-tthumb img, .h-tthumb svg { max-width: 88%; max-height: 88%; }
.h-tpl small { font-size: calc(10.5px * var(--fz)); color: var(--accent-ink); font-weight: 700; letter-spacing: .02em; }
.h-tpl b { font-size: calc(13px * var(--fz)); font-weight: 600; }
.h-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 22px 18px; border-radius: 14px; }
.h-card { display: flex; flex-direction: column; gap: 4px; cursor: pointer; min-width: 0; }
.h-thumb { position: relative; aspect-ratio: 1.62; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(var(--panel-2), var(--hover)) center / cover no-repeat; display: grid; place-items: center; color: var(--muted-2); margin-bottom: 6px; transition: .15s; }
.h-card:hover .h-thumb { border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.h-card b { font-size: calc(14.5px * var(--fz)); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-card small { font-size: calc(12.5px * var(--fz)); color: var(--muted); }
.h-card small.muted { color: var(--muted-2); }
.h-open { position: absolute; left: 8px; top: 8px; font-style: normal; font-size: calc(10.5px * var(--fz)); font-weight: 700; background: var(--accent); color: var(--on-accent); border-radius: 6px; padding: 2px 7px; }
.h-row .h-open { position: static; margin-left: 8px; }
.h-own { position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 3px; font-style: normal; font-size: calc(10.5px * var(--fz)); font-weight: 700; border-radius: var(--r-sm); padding: 2px 7px; background: var(--glass); color: var(--muted); }
.h-own.ok { background: var(--accent-soft); color: var(--accent-dark); }
.h-row .h-own { position: static; margin-left: 8px; }
.h-star, .h-more { border: 0; background: var(--glass); width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; color: var(--muted); box-shadow: 0 1px 4px rgba(20, 30, 48, .12); flex: none; }
.h-thumb .h-star { position: absolute; right: 44px; top: 8px; opacity: 0; transition: .15s; }
.h-thumb .h-more { position: absolute; right: 8px; top: 8px; opacity: 0; transition: .15s; }
.h-card:hover .h-star, .h-card:hover .h-more, .h-star.on { opacity: 1; }
.h-star.on { color: var(--c-fav); }
.h-star:hover, .h-more:hover { color: var(--ink); }
.h-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.h-row { display: grid; grid-template-columns: 56px minmax(180px, 2fr) 1.2fr 1fr 1.2fr 90px 36px 36px; align-items: center; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--line); cursor: pointer; font-size: calc(13px * var(--fz)); }
.h-row:first-child { border-top: 0; }
.h-row.head { cursor: default; font-size: calc(11.5px * var(--fz)); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; background: var(--panel-2); }
.h-row:not(.head):hover { background: var(--hover); }
.h-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-row > span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-row .h-star, .h-row .h-more { box-shadow: none; background: none; }
.h-rthumb { width: 56px; height: 38px; border-radius: 7px; border: 1px solid var(--line); background: var(--hover) center / cover no-repeat; }
.h-vt button { display: grid; place-items: center; padding: 5px 8px; }
.h-sort { display: flex; align-items: center; gap: 8px; font-size: calc(13px * var(--fz)); color: var(--muted); font-weight: 600; }
.h-sort select { padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); font-weight: 600; }
.h-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.h-folder { display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--line); border-radius: 12px; padding: 14px 12px 14px 16px; cursor: pointer; background: var(--panel); color: var(--ink); font: inherit; text-align: left; transition: .15s; min-height: 72px; }
.h-folder > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.h-folder b { font-size: calc(14px * var(--fz)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .h-folder small { color: var(--muted); }
.h-folder .ic { color: var(--accent-ink); flex: none; }
.h-folder .h-more { box-shadow: none; background: none; }
.h-folder.add { border-style: dashed; color: var(--muted); font-weight: 600; }
.h-folder.add .ic { color: var(--muted); }
.h-folder:hover { border-color: var(--ink); }
[data-drop].over { outline: 2px dashed var(--accent); outline-offset: 4px; background: var(--accent-soft); }
.h-chips { margin-bottom: 18px; }
.h-del { position: absolute; right: 6px; top: 6px; z-index: 2; border: 0; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--glass); color: var(--muted); cursor: pointer; opacity: 0; box-shadow: 0 1px 4px rgba(20, 30, 48, .15); }
.h-tpl:hover .h-del, .h-asset:hover .h-del { opacity: 1; }
.h-del:hover { color: var(--danger); }
.h-assets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.h-asset { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: var(--panel); display: flex; flex-direction: column; gap: 4px; }
.h-asset img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 8px; background: repeating-conic-gradient(var(--hover) 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.h-asset small { font-size: calc(11.5px * var(--fz)); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-empty { border: 1.5px dashed var(--line); border-radius: 14px; padding: 36px; text-align: center; color: var(--muted); }
.h-panel { border: 1.5px solid var(--line); border-radius: 16px; padding: 18px 20px; margin-bottom: 16px; max-width: 860px; background: var(--panel); }
.h-panel h3 { font-size: calc(15px * var(--fz)); margin-bottom: 10px; }
.h-panel p { margin: 6px 0; color: var(--ink); line-height: 1.5; }
.h-panel .muted, .h-panel p.muted { color: var(--muted); }
.h-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 16px; margin-top: 10px; }
.h-form label { display: flex; flex-direction: column; gap: 6px; font-size: calc(12.5px * var(--fz)); font-weight: 600; color: var(--muted); }
.h-form label.wide { grid-column: 1 / -1; }
.h-form label.chk { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); align-self: end; padding-bottom: 8px; }
.h-form label.chk input { accent-color: var(--accent); width: 16px; height: 16px; }
.h-form input:not([type=checkbox]), .h-form select { padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px; font-size: calc(14px * var(--fz)); color: var(--ink); background: var(--panel); outline: none; }
.h-form input:focus, .h-form select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.h-form input:disabled { background: var(--field); }
.h-form .inp input { border: 0; padding: 9px 0; box-shadow: none; }
.h-actions { display: flex; gap: 8px; margin-top: 12px; }
.h-path { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.h-path code { flex: 1; background: var(--field); border-radius: 10px; padding: 9px 12px; font-size: calc(12.5px * var(--fz)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-panel .code-row { display: flex; gap: 8px; margin: 12px 0 4px; max-width: 520px; }
.h-panel .code-row input { flex: 1; font: inherit; font-size: calc(15px * var(--fz)); letter-spacing: .06em; text-transform: uppercase; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px; }
.plan.cur { border-color: var(--accent); background: var(--accent-soft); }
.h-menu { position: fixed; z-index: 90; min-width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 40px rgba(20, 30, 48, .18); padding: 6px; }
.h-menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: calc(13px * var(--fz)); font-weight: 600; text-align: left; color: var(--ink); }
.h-menu button:hover { background: var(--accent-soft); }
.h-menu button.chk { color: var(--accent-dark); }
.h-menu button.danger { color: var(--danger); }
.h-menu .h-ma { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: calc(13px * var(--fz)); font-weight: 600; color: var(--ink); text-decoration: none; } .h-menu .h-ma:hover { background: var(--accent-soft); }
.h-acct { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; font: inherit; color: var(--ink); text-align: left; flex: none; }
.h-acct:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.h-acct span { display: flex; flex-direction: column; line-height: 1.15; } .h-acct b { font-size: calc(13px * var(--fz)); } .h-acct small { font-size: calc(11px * var(--fz)); }
.h-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 800; color: var(--on-dark); background: linear-gradient(135deg, var(--accent, var(--accent-strong)), var(--lav)); }
/* đổi tên tại chỗ + thanh Hoàn tác (dùng chung) */
.inl-edit { border: 1.5px solid var(--accent, var(--accent-strong)); border-radius: 6px; padding: 1px 6px; background: var(--panel); color: var(--ink); outline: none; box-shadow: 0 0 0 3px var(--accent-soft, rgba(16,185,129,.18)); min-width: 0; max-width: 100%; box-sizing: border-box; }
.undo-bar { position: fixed; left: 50%; bottom: 22px; z-index: 300; transform: translate(-50%, 90px); display: flex; align-items: center; gap: 14px; background: var(--inv); color: var(--on-inv); border-radius: 12px; padding: 10px 10px 10px 16px; font-size: calc(13.5px * var(--fz)); font-weight: 600; box-shadow: 0 16px 40px rgba(20, 30, 48, .3); transition: transform .22s ease; }
.undo-bar.on { transform: translate(-50%, 0); }
.undo-bar button { border: 0; background: color-mix(in srgb, var(--on-inv) 14%, transparent); color: var(--on-inv); font: inherit; font-weight: 800; border-radius: 8px; padding: 6px 12px; cursor: pointer; } .undo-bar button:hover { background: color-mix(in srgb, var(--on-inv) 24%, transparent); }
.h-menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.h-mlabel { font-size: calc(11px * var(--fz)); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px 4px; }
.h-web { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 6px 8px 10px; font-size: calc(12.5px * var(--fz)); }
.h-web a { color: var(--muted); text-decoration: none; } .h-web a:hover { color: var(--accent-ink); text-decoration: underline; }

/* ---------- Theme 2026: tiêu đề Editorial + gradient bảng màu ---------- */
.h-body h1 { font-family: var(--font-ui); font-weight: 800; letter-spacing: -.025em; font-size: 38px; line-height: 1.1; }
/* Logo (js/brand.js MARK, cùng hình favicon.svg): ô chuyển sắc mint, nét màu chữ trên nền mint */
.logo { background: var(--grad-mint) !important; color: var(--on-accent); box-shadow: 0 6px 16px rgba(52, 211, 153, .35) !important; }
::selection { background: var(--accent-2); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--lav); outline-offset: 2px; }

/* Hộp chọn font */
.font-field { display: inline-flex; min-width: 0; }
.font-btn { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 150px; max-width: 220px; height: 30px; padding: 0 10px; border: 1.5px solid var(--line); border-radius: 9px; background: var(--panel); cursor: pointer; color: var(--ink); font-size: calc(13.5px * var(--fz)); }
.font-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.font-btn:hover { border-color: var(--accent); }
.font-field.cb .font-btn { height: 26px; min-width: 140px; font-size: calc(12.5px * var(--fz)); border-width: 1px; border-radius: 6px; }
.p-col .font-field, .field .font-field { display: flex; } .p-col .font-btn, .field .font-btn { max-width: none; width: 100%; }
.fp-pop { position: fixed; z-index: 400; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 60px rgba(20, 30, 48, .22); display: flex; flex-direction: column; overflow: hidden; font: calc(13px * var(--fz))/1.35 var(--font-ui); color: var(--ink); }
.fp-pop.busy { opacity: .6; pointer-events: none; }
.fp-head { display: flex; gap: 6px; padding: 10px 10px 6px; }
.fp-q { flex: 1; min-width: 0; height: 32px; border: 1.5px solid var(--line); border-radius: 9px; padding: 0 10px; font: inherit; }
.fp-q:focus { outline: none; border-color: var(--accent); }
.fp-up { display: inline-flex; align-items: center; height: 32px; padding: 0 10px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-weight: 700; cursor: pointer; white-space: nowrap; font-size: calc(12.5px * var(--fz)); }
.fp-cats { display: flex; gap: 4px; padding: 0 10px 8px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.fp-cats button { flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: calc(12px * var(--fz)); cursor: pointer; color: var(--muted); }
.fp-cats button.on { background: var(--sel-bg); border-color: var(--accent-line); color: var(--sel-ink); }
.fp-list { flex: 1; overflow-y: auto; padding: 4px; min-height: 120px; }
.fp-item { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 8px; cursor: pointer; outline: none; flex-wrap: wrap; }
.fp-item:hover, .fp-item:focus { background: var(--field); } .fp-item.on { background: var(--accent-soft); }
.fp-name { font-size: calc(18px * var(--fz)); line-height: 1.25; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-item small { width: 100%; order: 3; color: var(--muted); font-size: calc(11px * var(--fz)); }
.fp-tags { display: flex; gap: 4px; }
.fp-tag { font-size: calc(10.5px * var(--fz)); font-weight: 700; color: var(--muted); background: var(--hover); border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.fp-tag.mine { background: var(--lav-soft); color: var(--lav-ink); } .fp-tag.warn { background: var(--warn-soft); color: var(--warn-ink); }
.fp-del { border: 0; background: none; color: var(--muted); font-size: calc(16px * var(--fz)); line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 5px; } .fp-del:hover { color: var(--danger); background: var(--danger-soft); }
.fp-empty { padding: 18px 12px; color: var(--muted); text-align: center; }
.fp-foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 7px 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: calc(12px * var(--fz)); }
.fp-foot label { display: flex; align-items: center; gap: 5px; cursor: pointer; }
.fp-head, .fp-cats, .fp-foot { flex: none; }

/* Bước Dieline: mockup 3D là ô xem trước nhỏ ở góc (không chia đôi màn hình) */
.views.pip { grid-template-columns: 1fr; position: relative; }
.views.pip #view3d { position: absolute; right: 16px; bottom: 16px; width: min(300px, 34%); height: min(250px, 42%); z-index: 6; border: 1px solid var(--line); box-shadow: 0 18px 40px rgba(20, 30, 48, .18); border-radius: 16px; }
.views.pip #view3d > .float { display: none !important; }
body.fb-on .views.pip #view3d { bottom: 74px; } /* chừa chỗ cho bong bóng góp ý ở góc */

/* Bong bóng góp ý (js/feedback.js): nút tròn góc dưới phải, thỉnh thoảng có vệt sáng lướt qua; hộp chat mở phía trên */
.fb-bub { position: fixed; right: 18px; bottom: 18px; z-index: 110; width: 50px; height: 50px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-2); overflow: hidden; transition: transform .2s, box-shadow .2s; }
.fb-bub:hover { transform: translateY(-2px) scale(1.04); }
.fb-bub.on { background: var(--inv); color: var(--on-inv); }
.fb-bub::after { content: ""; position: absolute; inset: -20%; background: linear-gradient(115deg, transparent 35%, color-mix(in srgb, var(--accent-2) 75%, transparent) 50%, transparent 65%); transform: translateX(-120%); animation: fb-shine 9s ease-in-out 3s infinite; pointer-events: none; }
.fb-bub.on::after { animation: none; }
@keyframes fb-shine { 0%, 82% { transform: translateX(-120%); } 92%, 100% { transform: translateX(120%); } }
body.studio-open .fb-bub { bottom: 34px; right: 12px; width: 44px; height: 44px; }
body.pe-open .fb-bub, body.mb-open .fb-bub { bottom: 34px; right: 12px; width: 44px; height: 44px; }
.fb-box { position: fixed; right: 18px; bottom: 80px; z-index: 111; width: min(360px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 110px)); display: flex; flex-direction: column; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); opacity: 0; transform: translateY(12px) scale(.98); transform-origin: bottom right; transition: opacity .2s, transform .2s; }
.fb-box.in { opacity: 1; transform: none; }
body.studio-open .fb-box, body.pe-open .fb-box, body.mb-open .fb-box { right: 12px; bottom: 90px; }
.fb-box header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.fb-box header b { display: block; font-size: calc(14px * var(--fz)); } .fb-box header small { color: var(--muted); font-size: calc(11.5px * var(--fz)); } .fb-box header .sp { flex: 1; }
.fb-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.fb-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; border-radius: var(--r-sm); display: grid; } .fb-x:hover { background: var(--hover); color: var(--ink); }
.fb-body { padding: 12px 14px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.fb-msg { align-self: flex-start; max-width: 88%; background: var(--panel-2); border: 1px solid var(--line); padding: 8px 11px; border-radius: 14px 14px 14px 4px; font-size: calc(13px * var(--fz)); line-height: 1.45; }
.fb-msg.me { align-self: flex-end; background: var(--sel-bg); color: var(--sel-ink); border-color: transparent; border-radius: 14px 14px 4px 14px; }
.fb-rate { display: flex; align-items: center; gap: 2px; padding: 2px 0 4px; }
.fb-rate button { border: 0; background: none; padding: 3px; cursor: pointer; color: var(--muted-2, var(--muted)); border-radius: var(--r-sm); transition: transform .15s, color .15s; }
.fb-rate button:hover { transform: scale(1.12); color: var(--warn); }
.fb-rate button.on { color: var(--warn); } .fb-rate button.on svg { fill: currentColor; }
.fb-rate small { margin-left: 8px; color: var(--muted); font-size: calc(12px * var(--fz)); font-weight: 600; }
.fb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fb-chips button { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: var(--r-pill); padding: 5px 11px; font: inherit; font-size: calc(12.5px * var(--fz)); cursor: pointer; }
.fb-chips button:hover { border-color: var(--accent); } .fb-chips button.on { background: var(--sel-bg); color: var(--sel-ink); border-color: transparent; }
.fb-in { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); }
.fb-in textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px; font: inherit; font-size: calc(13px * var(--fz)); background: var(--panel-2); color: var(--ink); max-height: 120px; }
.fb-send { width: 38px; height: 38px; flex: none; border: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; cursor: pointer; } .fb-send:disabled { opacity: .5; }
@media (prefers-reduced-motion: reduce) { .fb-bub::after { animation: none; } .fb-box { transition: none; } }
@media (max-width: 600px) { .fb-bub { right: 12px; bottom: 12px; } .fb-box { right: 12px; bottom: 72px; } }
.pip-bar { display: none; }
.views.pip .pip-bar { display: flex; align-items: center; gap: 4px; position: absolute; z-index: 4; left: 8px; right: 8px; top: 8px; font-size: calc(11.5px * var(--fz)); color: var(--ink); pointer-events: none; }
.views.pip .pip-bar b { background: var(--glass); padding: 3px 8px; border-radius: 7px; } .pip-bar .sp { flex: 1; }
.views.pip .pip-bar .tb { pointer-events: auto; background: var(--glass); width: 26px; height: 26px; padding: 0; display: grid; place-items: center; border-radius: 7px; }
/* Tab quy trình luôn ở chính giữa thanh trên — không nhảy chỗ khi chuyển Dieline ↔ Design ↔ Mockup */
/* Dải quy trình: CÙNG một chỗ (giữa thanh trên) và cùng 5 bước ở màn Dieline (#flow) lẫn Studio (#aiFlow) — không nhảy khi chuyển bước */
.topbar #flow, .ai-menubar #aiFlow { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; z-index: 1; }
.flow li[data-flow="share"] i, .flow li[data-flow="out"] i, .flow li[data-flow="mood"] i { background: var(--hover); color: var(--muted); }
.crumb { max-width: calc(50vw - 600px); }
@media (max-width: 1680px) { :is(#flow, #aiFlow) li { padding-right: 7px; } :is(#flow, #aiFlow) li:not(.on) { font-size: 0; gap: 0; } :is(#flow, #aiFlow) li:not(.on) i { font-size: calc(11px * var(--fz)); } .crumb { max-width: calc(50vw - 480px); } }
@media (max-width: 1399px) { .ai-menubar .ai-bname { display: none; } }
@media (max-width: 1259px) { .ai-menus button { padding: 6px 7px; } .ai-menubar #aiFlow { position: static; transform: none; margin: 0 6px; } }

/* Dieline chỉ sửa khuôn: ẩn bảng chèn / lớp / màu nền của thiết kế (các việc này làm ở Design) */
.layout.die-only { --rw: 0px; --rr: 0px; }
.layout.die-only .side.right, .layout.die-only .rrail, body:has(.layout.die-only) #btnRight { display: none !important; }

/* ---------- Bộ công cụ dựng khuôn: thanh dọc trên khuôn (như Illustrator) ---------- */
.die-tools { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); z-index: 5; display: flex; align-items: flex-start; gap: 8px; pointer-events: none; }
.die-tools > * { pointer-events: auto; }
.dt-col { display: flex; flex-direction: column; gap: 3px; background: var(--glass); padding: 5px; border-radius: 14px; box-shadow: 0 10px 28px rgba(20, 30, 48, .16); border: 1px solid var(--line); }
.dt-col button { position: relative; width: 38px; height: 38px; border: 0; background: none; border-radius: 9px; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.dt-col button .ic { width: 21px; height: 21px; }
.dt-col button:hover:not(:disabled) { background: var(--hover); }
.dt-col button.on, .dt-col button.primary { background: var(--sel-bg); color: var(--sel-ink); }
.dt-col button:disabled { color: var(--muted-2); cursor: default; }
.dt-col #dtDel:not(:disabled) { color: var(--danger); }
.dt-col hr { border: 0; border-top: 1px solid var(--line); margin: 3px 4px; }
.dt-fly { display: flex; flex-direction: column; gap: 6px; }
.dt-opts { background: var(--glass); border: 1px solid var(--line); border-radius: 12px; padding: 5px; box-shadow: 0 10px 28px rgba(20, 30, 48, .14); }
.dt-icons { display: grid; grid-template-columns: repeat(4, 40px); gap: 3px; }
.dt-icons.lbl { grid-template-columns: repeat(4, 54px); }
.dt-icons.lbl button { height: 50px; grid-template-rows: 1fr auto; padding: 5px 2px 4px; gap: 2px; }
.dt-icons.lbl button span { font-size: calc(10px * var(--fz)); font-weight: 600; color: var(--muted); white-space: nowrap; }
.dt-icons.lbl button.on span { color: var(--accent-ink); }
#lockLib.dt-icons { grid-template-columns: repeat(4, 46px); }
.dt-icons button { height: 38px; border: 1.5px solid transparent; background: var(--field); border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--ink); padding: 0; }
.dt-icons button:hover { border-color: var(--line); background: var(--panel); }
.dt-icons button.on { border-color: var(--accent); background: var(--accent-soft); }
.dt-icons svg { max-width: 100%; height: auto; }

/* Biến thể & chia sẻ */
.variant-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.variant-bar .sp { flex: 1; }
.variant-bar .vshare { display: inline-flex; align-items: center; gap: 6px; }
.vmenu { display: flex !important; flex-direction: column; min-width: 300px; padding: 6px; }
.vmenu button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.vmenu button b { display: flex; align-items: center; gap: 8px; } .vmenu button small { color: var(--muted); font-weight: 400; padding-left: 24px; }
.vsize { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; } .vsize .field { display: flex; flex-direction: column; gap: 4px; }
.vsize input { padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 9px; font: inherit; }
.vsize-act { margin-top: 14px; display: flex; justify-content: flex-end; }
.share-box { min-width: min(560px, 86vw); display: flex; flex-direction: column; gap: 12px; }
.share-prog { padding: 14px; background: var(--field); border-radius: 10px; }
.share-ok { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--accent-soft); border-radius: 12px; }
.share-ok .code-row { display: flex; gap: 6px; } .share-ok input { flex: 1; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 9px; font: inherit; }
.share-row { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.share-row .sr-h { display: flex; gap: 10px; align-items: center; } .share-row .sr-h a { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-row small { color: var(--muted); } .sr-votes { margin: 4px 0 0; padding-left: 18px; font-size: calc(13px * var(--fz)); } .link.danger { color: var(--danger); }
.sr-cmts { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; font-size: calc(13px * var(--fz)); } .sr-cg ul { margin: 2px 0 0; padding-left: 18px; } .sr-cg i { color: var(--accent-ink); font-style: normal; font-weight: 700; }
.crow.removed .link { display: inline-flex !important; margin-left: auto; color: var(--accent-ink); font-weight: 700; }
.sr-lock { display: flex; gap: 6px; align-items: center; font-size: calc(12px * var(--fz)); color: var(--muted); margin-top: 6px; cursor: pointer; } .sr-lock input { accent-color: var(--accent-dark); }

/* ---------- Màu theo phân loại (Mint = thiết kế · Lavender = khuôn / mẫu hộp · Coral = moodboard / ảnh · Midnight = chung) ---------- */
:root { --c-design: #047857; --c-design-bg: #e7faf2; --c-die: #2f63c7; --c-die-bg: #edf3ff; --c-mood: #e0565e; --c-mood-bg: #fff1ef; --c-img: #c2610f; --c-img-bg: #fff4e6; --c-fav: #d99a00; --c-fav-bg: #fff8db; --c-acct: #7c4dcc; --c-acct-bg: #f3edff; }
.h-nav button svg.ic { width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: var(--hover); color: var(--ink-2); flex: none; transition: transform .15s; }
.h-nav button:hover svg.ic { transform: scale(1.08); }
.h-nav [data-page="home"] svg.ic { background: var(--grad-night); color: var(--on-dark); }
.h-nav [data-page="files"] svg.ic { background: var(--c-design-bg); color: var(--c-design); }
.h-nav [data-page="fav"] svg.ic { background: var(--c-fav-bg); color: var(--c-fav); }
.h-nav [data-page="templates"] svg.ic, .h-nav [data-page="imports"] svg.ic { background: var(--c-die-bg); color: var(--c-die); }
.h-nav [data-page="assets"] svg.ic { background: var(--c-img-bg); color: var(--c-img); }
.h-nav [data-page="account"] svg.ic { background: var(--c-acct-bg); color: var(--c-acct); }
/* thẻ tệp: chữ loại tệp + dải màu trên ảnh theo loại */
.h-card[data-pid] > small:not(.muted) { color: var(--c-design); font-weight: 600; }
.h-card[data-mood] > b::before, .h-card[data-pid] > b::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; background: var(--accent); }
.h-card[data-mood] > b::before { background: var(--coral); }
.h-card[data-mood] .h-thumb { box-shadow: inset 0 3px 0 var(--coral); }
.h-card[data-pid] .h-thumb { box-shadow: inset 0 3px 0 var(--accent); }
.h-card[data-pid] .h-thumb.dl { box-shadow: inset 0 3px 0 var(--lav); }
.h-card[data-pid]:has(.h-thumb.dl) > b::before { background: var(--lav); }
.h-card[data-pid]:has(.h-thumb.dl) > small { color: var(--c-die); }
.h-ftype [data-ftype="design"] svg.ic { color: var(--c-design); } .h-ftype [data-ftype="mood"] svg.ic { color: var(--c-mood); } .h-ftype [data-ftype="dieline"] svg.ic { color: var(--c-die); }
.h-ftype .chip.on[data-ftype="design"] { background: var(--c-design-bg); color: var(--c-design); border-color: var(--accent); }
.h-ftype .chip.on[data-ftype="mood"] { background: var(--c-mood-bg); color: var(--c-mood); border-color: var(--coral); }
.h-ftype .chip.on[data-ftype="dieline"] { background: var(--c-die-bg); color: var(--c-die); border-color: var(--lav); }

.imp-chk { display: flex; align-items: flex-start; gap: 8px; font-size: calc(13px * var(--fz)); line-height: 1.35; margin: 6px 0; cursor: pointer; } .imp-chk input { margin-top: 2px; accent-color: var(--accent-dark); }
.imp-mode { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.imp-mode .imp-chk { border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 0; } .imp-mode .imp-chk:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.imp-mode span { display: flex; flex-direction: column; gap: 2px; } .imp-mode small { color: var(--muted); font-size: calc(11.5px * var(--fz)); }
.imp-chk input { width: auto !important; flex: none; }
.imp-assets .imp-groups, .imp-assets #impStats, .imp-assets #impW, .imp-assets #impOrient { opacity: .45; pointer-events: none; }

/* Bảng Mẫu hộp: lọc theo kiểu cấu trúc / mockup sản phẩm */
.tpl-model { width: 100%; margin: 2px 0 10px; }

/* Cảnh mockup 3D */
.scene-pop { position: absolute; top: 56px; right: 14px; z-index: 6; width: 300px; background: var(--panel, #fff); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 40px rgba(20, 30, 48, .16); padding: 12px; }
.scene-pop .sp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.sp-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; padding: 0; cursor: pointer; font-size: calc(11px * var(--fz)); color: var(--ink); }
.sp-grid button i { width: 56px; height: 44px; border-radius: 10px; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(20, 30, 48, .12); background-size: cover; }
.sp-grid button.on i { border-color: var(--accent, var(--accent)); }
.sp-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; font-size: calc(13px * var(--fz)); }
.sp-row select { flex: 0 0 150px; }
.sp-grad select { flex: 1 1 auto; min-width: 0; }
.sp-grad input[type=color] { flex: 0 0 30px; width: 30px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: none; }

/* ---------- Trang chủ app: hành trình người mới (checklist, còn x/3 miễn phí, NPS, Góp ý) — giao-dien.md ---------- */
.h-journey { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin: 0 0 22px; }
.h-jcard, .h-quota, .h-nps { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.h-jcard { border-color: var(--accent-line); background: linear-gradient(160deg, var(--accent-soft), var(--panel) 60%); }
.h-jhead { display: flex; align-items: center; gap: 10px; width: 100%; } .h-jhead b { font-size: calc(15px * var(--fz)); } .h-jhead small { color: var(--accent-ink); font-weight: 700; } .h-jhead .icon-btn { margin-left: auto; width: 28px; height: 28px; border: 0; background: transparent; }
.h-jbar { width: 100%; height: 6px; border-radius: var(--r-pill); background: var(--hover); overflow: hidden; } .h-jbar i { display: block; height: 100%; border-radius: inherit; background: var(--grad-mint); transition: width .4s; }
.h-jcard ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; width: 100%; }
.h-jcard li { display: flex; align-items: center; gap: 10px; font-size: calc(13px * var(--fz)); color: var(--muted); }
.h-jcard li i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--hover); font-size: calc(11px * var(--fz)); font-weight: 800; flex: none; }
.h-jcard li .ic { width: 20px; height: 20px; padding: 3px; border-radius: 50%; background: var(--accent); color: var(--on-accent); flex: none; }
.h-jcard li.ok span { text-decoration: line-through; text-decoration-color: var(--muted-2); } .h-jcard li.now { color: var(--ink); font-weight: 700; } .h-jcard li.now i { background: var(--inv); color: var(--on-inv); }
.h-jtip { color: var(--muted); }
.h-quota b { font-size: calc(15px * var(--fz)); } .h-quota small { color: var(--muted); line-height: 1.45; } .h-quota .h-usage { width: 100%; }
.h-quota.out { border-color: var(--warn); background: linear-gradient(160deg, var(--warn-soft), var(--panel) 60%); } .h-quota.out .h-jbar i { background: var(--warn); }
.h-nps b { font-size: calc(14px * var(--fz)); } .h-nps small { display: flex; justify-content: space-between; width: 100%; color: var(--muted); font-size: calc(11px * var(--fz)); }
.h-nps-row { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; width: 100%; }
.h-nps-row button { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-sm); padding: 6px 0; font-weight: 700; cursor: pointer; } .h-nps-row button:hover { background: var(--sel-bg); color: var(--sel-ink); border-color: var(--accent-line); }
.h-fbbtn { border: 0; background: none; padding: 0; font: inherit; color: var(--accent-ink); font-weight: 700; cursor: pointer; } .h-fbbtn:hover { text-decoration: underline; }
.h-fb textarea { width: 100%; box-sizing: border-box; font: inherit; border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; resize: vertical; margin-bottom: 12px; } .h-fb textarea:focus { outline: none; border-color: var(--accent); }
.h-tthumb img { object-fit: contain; }
/* ---------- Giao diện tối — MẶC ĐỊNH cho app và website (js/theme-boot.js đặt html[data-theme] trước khi vẽ trang) ----------
   Chỉ đổi token; canvas / artboard / màu tác phẩm giữ nguyên (giao-dien.md). Chọn giao diện sáng: nút sáng / tối (js/theme.js) */
:root[data-theme="dark"] {
  --bg: #1d2027; --panel: #282c34; --panel-2: #23272e; --field: #1e2228; --hover: #343943; --linen: #2e333c;
  --line: #3a404a; --line-strong: #4b5260; --ink: #e9ecf1; --ink-2: #d2d8e1; --ink-3: #bcc3ce; --muted: #9ca5b3; --muted-2: #7c8594;
  --canvas-bg: #17191e; --glass: rgba(40, 44, 52, .94);
  --c-design: #6ee7b7; --c-design-bg: rgba(52, 211, 153, .16); --c-die: #9cc2ff; --c-die-bg: rgba(106, 164, 255, .16); --c-mood: #ff9a9e; --c-mood-bg: rgba(255, 154, 158, .16);
  --c-img: #f6b06b; --c-img-bg: rgba(245, 158, 75, .16); --c-fav: #f6c27a; --c-fav-bg: rgba(246, 194, 122, .16); --c-acct: #c4a8ff; --c-acct-bg: rgba(167, 139, 250, .16);
  --accent-ink: #6ee7b7; --accent-dark: #34d399; --accent-soft: rgba(52, 211, 153, .16); --accent-line: rgba(52, 211, 153, .45);
  --sel-bg: rgba(52, 211, 153, .18); --sel-ink: #6ee7b7;
  --lav-soft: rgba(106, 164, 255, .16); --lav-ink: #9cc2ff; --coral-soft: rgba(255, 154, 158, .16);
  --danger: #ff6b72; --danger-soft: rgba(255, 107, 114, .16); --warn: #f59e4b; --warn-soft: rgba(245, 158, 75, .16); --warn-ink: #f6c27a; --ok: #6ee7b7;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .35); --shadow-1: var(--shadow); --shadow-2: 0 12px 40px rgba(0, 0, 0, .5);
  --inv: #e9ecf1; --on-inv: #141e30; --on-accent: #0f1b2d;
  color: var(--ink); color-scheme: dark;
}
:root[data-theme="dark"] .layout { background: var(--bg); }
.h-persona { background: var(--panel); border: 1px solid var(--accent-line); border-radius: var(--r-lg); padding: 18px 20px; margin: 0 0 14px; box-shadow: var(--shadow-1); display: grid; gap: 6px; justify-items: start; }
.h-persona > b { font-size: calc(17px * var(--fz)); } .h-persona > small { color: var(--muted); }
.h-persona-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; margin: 8px 0 4px; }
.h-persona-row button { display: flex; align-items: center; gap: 12px; text-align: left; border: 1.5px solid var(--line); background: var(--panel); border-radius: var(--r-md); padding: 12px 14px; cursor: pointer; color: var(--ink); }
.h-persona-row button:hover { border-color: var(--accent); background: var(--sel-bg); } .h-persona-row button .ic { color: var(--accent-ink); flex: none; }
.h-persona-row span { display: grid; } .h-persona-row small { color: var(--muted); font-size: calc(12px * var(--fz)); }
@media (max-width: 900px) { .h-persona-row { grid-template-columns: 1fr; } }
/* Góp ý khách trên link duyệt: chấm số mới, hội thoại, ô trả lời (app.js loadShares) */
.sh-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: var(--r-pill); background: var(--danger); color: var(--on-dark); font: 700 calc(11px * var(--fz))/1 var(--font-ui); font-style: normal; }
.sr-new { margin: 0 0 6px; font-size: calc(12.5px * var(--fz)); font-weight: 700; color: var(--warn-ink); display: flex; align-items: center; gap: 5px; }
.sr-cg li.me { color: var(--accent-ink); }
.sr-reply { display: flex; gap: 6px; margin: 6px 0 4px; } .sr-reply input { flex: 1; min-width: 0; font: inherit; font-size: calc(13px * var(--fz)); padding: 6px 9px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--field); color: var(--ink); }

/* Khay việc chạy nền (js/jobs.js): mở / tải file lâu — thanh tiến trình, xong thì thành thông báo bấm được */
.jobs { position: fixed; top: 64px; right: 16px; z-index: 320; display: flex; flex-direction: column; gap: 8px; width: min(340px, calc(100vw - 32px)); pointer-events: none; }
.job { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 11px 10px 11px 12px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); font-family: var(--font-ui); animation: job-in .28s cubic-bezier(.16, 1, .3, 1); transition: opacity .2s, transform .2s; }
.job.out { opacity: 0; transform: translateX(16px); }
.job-ic { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent-ink); }
.job.err .job-ic { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.job-t { flex: 1; min-width: 0; }
.job-t b { display: block; font-size: calc(13px * var(--fz)); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-t small { display: block; margin-top: 2px; font-size: calc(12px * var(--fz)); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-bar { height: 4px; margin-top: 8px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; }
.job-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .25s; }
.job.run .job-ic svg { animation: job-pulse 1.2s ease-in-out infinite; }
.job.ok .job-bar, .job.err .job-bar { display: none; } .job-cancel { margin-top: 8px; } .job.ok .job-cancel, .job.err .job-cancel, .job.mini .job-cancel { display: none; }
.job.link { cursor: pointer; border-color: var(--accent-line); }
.job.link:hover { background: var(--hover); }
.job.link .job-t small { color: var(--accent-ink); }
.job.mini { padding: 6px 8px; cursor: pointer; } .job.mini .job-t small, .job.mini .job-x { display: none; } .job.mini .job-bar { margin-top: 5px; }
.job-x { flex: none; margin: -2px -2px 0 0; }
@keyframes job-in { from { opacity: 0; transform: translateY(-8px); } }
/* Hộp tiến trình giữa màn hình (js/jobs.js progress): việc AI / tải mô hình / xuất file lâu */
.pv-prog { position: fixed; inset: 0; z-index: 330; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 35%, transparent); cursor: progress; animation: pv-prog-in .2s .15s cubic-bezier(.16, 1, .3, 1) both; } /* trễ .15 s: việc nhanh không nháy hộp */
.pv-prog[hidden] { display: none; }
.pv-prog-c { display: flex; align-items: center; gap: 12px; width: min(400px, calc(100vw - 32px)); padding: 16px 18px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); font-family: var(--font-ui); }
.pv-prog-ic { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent-ink); }
.pv-prog-ic svg { animation: job-pulse 1.2s ease-in-out infinite; }
.pv-prog-t { flex: 1; min-width: 0; }
.pv-prog-t b { display: block; font-size: calc(14px * var(--fz)); font-weight: 600; }
.pv-prog-t small { display: block; margin-top: 3px; font-size: calc(12px * var(--fz)); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-prog-bar { position: relative; height: 6px; margin-top: 10px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; }
.pv-prog-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .25s; }
.pv-prog-bar.ind i { position: absolute; left: 0; width: 35% !important; animation: pv-prog-run 1.1s cubic-bezier(.45, 0, .55, 1) infinite; will-change: transform; } /* transform: chỉ ghép lớp, không vẽ lại trang — không giành CPU của AI */
.pv-prog-pc { flex: none; min-width: 34px; text-align: right; font-size: calc(12px * var(--fz)); font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
@keyframes pv-prog-run { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
@keyframes pv-prog-in { from { opacity: 0; } }
/* Thanh tải trên cùng lúc mở app (index.html #bootBar, gỡ khi app.js mở xong) */
.boot-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 340; height: 3px; overflow: hidden; background: color-mix(in srgb, var(--accent) 18%, transparent); pointer-events: none; }
.boot-bar i { position: absolute; left: 0; top: 0; height: 100%; width: 35%; background: var(--accent); animation: pv-prog-run 1.1s cubic-bezier(.45, 0, .55, 1) infinite; will-change: transform; }
@media (prefers-reduced-motion: reduce) { .boot-bar i { animation: none; width: 100%; opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .pv-prog-bar.ind i { animation: none; left: 0; width: 100% !important; opacity: .5; } .pv-prog-ic svg { animation: none; } }
@keyframes job-pulse { 50% { transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .job, .job.run .job-ic svg { animation: none; } }

/* ---------- Bảng trái bước Dieline gọn (0.17.2): ít chữ, ô vuông có hình, nút thay ô chọn ---------- */
.side.left { padding: 14px 14px 20px; }
.side.left .page-head { margin-bottom: 10px; }
.side.left .page-head h2 { font-size: calc(17px * var(--fz)); display: flex; align-items: baseline; gap: 6px; }
.side.left .page-head .count { font-size: calc(11.5px * var(--fz)); font-weight: 500; color: var(--muted); }
.side.left .sub-head { font-size: calc(11px * var(--fz)); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 0 7px; }
.side.left .sub-head.row-between { text-transform: none; letter-spacing: 0; font-size: calc(12px * var(--fz)); color: var(--ink); }
.imp-btns { display: inline-flex; gap: 4px; }
.icon-btn.sm { width: 30px; height: 30px; border-radius: var(--r-sm); }
/* Mẫu hộp */
.tpl-find { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: var(--r-md); padding: 0 4px 0 9px; background: var(--panel); margin-bottom: 8px; color: var(--muted); }
.tpl-find:focus-within { border-color: var(--accent); }
.tpl-find input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 8px 0; font: inherit; font-size: calc(13px * var(--fz)); color: var(--ink); }
.tpl-find .tpl-model { width: auto; max-width: 104px; margin: 0; border: 0; background: var(--hover); font-size: calc(12px * var(--fz)); padding: 4px 6px; border-radius: var(--r-sm); }
.chips.scroll-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px 10px; padding: 0 14px 2px; }
.chips.scroll-row::-webkit-scrollbar { display: none; }
.chips.scroll-row .chip { flex: none; }
.tpl-grid { gap: 8px; }
.tpl { padding: 6px 6px 8px; gap: 4px; }
.tpl b { font-size: calc(12px * var(--fz)); font-weight: 600; text-align: center; }
/* Kích thước */
.dim-grid { gap: 6px; }
.selects { gap: 10px; }
.selects .field, .params .field.opt { flex-direction: column; align-items: stretch; gap: 5px; }
.selects select { width: 100%; }
.field.opt { grid-column: 1 / -1; }
.field.opt .seg button { padding: 6px 4px; font-size: calc(12px * var(--fz)); overflow: hidden; text-overflow: ellipsis; }
.params.two-col { grid-template-columns: 1fr 1fr; }
.layout-pick { gap: 6px; }
/* Chất liệu: lưới ô vuông */
.mt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mt-grid.sm { grid-template-columns: repeat(4, 1fr); }
.mt { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 7px 4px 6px; border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; min-width: 0; }
.mt:hover { border-color: var(--line-strong, var(--muted-2)); }
.mt.on { border-color: var(--accent); background: var(--sel-bg); color: var(--sel-ink); }
.mt.off { opacity: .38; cursor: not-allowed; }
.mt canvas { width: 100%; aspect-ratio: 1; height: auto; max-width: 54px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); }
.mt-grid.sm .mt canvas { max-width: 40px; }
.mt b { font-size: calc(11.5px * var(--fz)); font-weight: 600; line-height: 1.2; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.mt small { font-size: calc(10.5px * var(--fz)); color: var(--muted); }
.mt.on small { color: inherit; opacity: .8; }
.mt .mat-rec { position: absolute; top: 4px; right: 4px; width: 16px; height: 16px; padding: 0; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); margin: 0; }
/* In ấn: ô số liệu */
.stats.tiles { grid-template-columns: 1fr 1fr; gap: 6px; font-size: calc(12px * var(--fz)); }
.stats.tiles > div { background: var(--hover); border-radius: var(--r-sm); padding: 7px 9px; min-width: 0; }
.stats.tiles > div.w { grid-column: 1 / -1; }
.stats.tiles dt { font-size: calc(10.5px * var(--fz)); color: var(--muted); margin-bottom: 2px; }
.stats.tiles dd { text-align: left; font-size: calc(13px * var(--fz)); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.two .btn { gap: 6px; }
/* Tự thiết kế: nút hành động gọn */
.seq-acts .link { font-size: calc(12px * var(--fz)); }

/* ---------- Trang Duyệt (bước 4, js/review.js) — 0.17.2 ---------- */
.rvw { position: fixed; left: 0; right: 0; bottom: 0; top: 58px; z-index: 40; display: grid; grid-template-columns: 290px 1fr 380px; background: var(--bg); }
.rvw[hidden] { display: none; }
.rv-l, .rv-r { background: var(--panel); overflow-y: auto; min-width: 0; }
.rv-l { border-right: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.rv-r { border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.rv-card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; display: flex; flex-direction: column; gap: 9px; background: var(--panel-2); }
.rv-card h3 { margin: 0; font-size: calc(13px * var(--fz)); display: flex; align-items: center; gap: 6px; }
.rv-card h3 small { margin-left: auto; color: var(--muted); font-weight: 500; }
.rv-url { display: flex; gap: 6px; }
.rv-url input { flex: 1; min-width: 0; font-size: calc(12px * var(--fz)); padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--field); color: var(--ink); }
.rv-meta { margin: 0; font-size: calc(11.5px * var(--fz)); color: var(--muted); display: flex; align-items: center; gap: 5px; }
.rv-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: rvspin .8s linear infinite; flex: none; }
@keyframes rvspin { to { transform: rotate(360deg); } }
.rv-sw { display: flex; align-items: center; gap: 7px; font-size: calc(12px * var(--fz)); color: var(--muted); cursor: pointer; }
.rv-sw input, .rv-vars input, .rv-done input { accent-color: var(--accent); }
.rv-vars { display: flex; flex-direction: column; gap: 4px; }
.rv-vars label { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; font-size: calc(12.5px * var(--fz)); }
.rv-vars label.on { background: var(--sel-bg); color: var(--sel-ink); }
.rv-vars small { grid-column: 2; color: var(--muted); font-size: calc(11px * var(--fz)); }
.rv-rounds { display: flex; flex-direction: column; gap: 4px; }
.rv-rounds button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; text-align: left; }
.rv-rounds button.on { background: var(--sel-bg); color: var(--sel-ink); border-color: var(--accent-line); }
.rv-rounds b { font-size: calc(12.5px * var(--fz)); } .rv-rounds small { font-size: calc(11px * var(--fz)); color: var(--muted); }
.rv-revoke { align-self: flex-start; font-size: calc(12px * var(--fz)); }
.rv-c { display: flex; flex-direction: column; min-width: 0; }
.rv-cbar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--panel); font-size: calc(13px * var(--fz)); }
.rv-cbar .sp { flex: 1; }
.rv-frame { flex: 1; position: relative; min-height: 0; }
.rv-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); }
.rv-wait { margin: 0; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: calc(13px * var(--fz)); }
.rv-rh { padding: 12px 14px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.rv-rh h3 { margin: 0 0 8px; font-size: calc(14px * var(--fz)); }
.rv-filter { display: flex; gap: 4px; flex-wrap: wrap; }
.rv-filter button { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: var(--r-pill); padding: 3px 10px; font: inherit; font-size: calc(12px * var(--fz)); cursor: pointer; }
.rv-filter button.on { background: var(--sel-bg); color: var(--sel-ink); border-color: var(--accent-line); }
.rv-filter i { font-style: normal; font-weight: 700; margin-left: 2px; }
.rv-votes { margin: 10px 14px 0; padding: 8px 10px; border-radius: var(--r-md); background: var(--accent-soft); font-size: calc(12.5px * var(--fz)); }
.rv-votes p { margin: 2px 0; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; } .rv-votes small { color: var(--muted); margin-left: auto; }
.rv-list { flex: 1; padding: 6px 14px 12px; display: flex; flex-direction: column; gap: 8px; }
.rv-list h4 { margin: 8px 0 0; font-size: calc(11px * var(--fz)); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rv-cm { display: grid; grid-template-columns: auto 1fr; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); }
.rv-cm.new { border-left: 3px solid var(--coral); }
.rv-cm.doing { border-left: 3px solid var(--warn); }
.rv-cm.done { opacity: .62; }
.rv-cm.done p { text-decoration: line-through; }
.rv-done { padding-top: 2px; } .rv-done input { width: 16px; height: 16px; cursor: pointer; }
.rv-cb { min-width: 0; }
.rv-ch { display: flex; align-items: center; gap: 6px; font-size: calc(12.5px * var(--fz)); flex-wrap: wrap; }
.rv-ch small { color: var(--muted); font-size: calc(11px * var(--fz)); } .rv-ch .sp { flex: 1; }
.rv-ok { display: inline-flex; align-items: center; gap: 3px; font-size: calc(11px * var(--fz)); font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); border-radius: var(--r-pill); padding: 0 7px; }
.rv-doing { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: var(--r-pill); padding: 1px 8px; font: inherit; font-size: calc(11px * var(--fz)); cursor: pointer; }
.rv-doing.on { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.rv-cb p { margin: 4px 0 0; font-size: calc(13px * var(--fz)); white-space: pre-wrap; line-height: 1.45; }
.rv-imgs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.rv-imgs img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); display: block; }
.rv-rep { margin-top: 7px; padding: 6px 9px; border-radius: var(--r-sm); background: var(--hover); font-size: calc(11.5px * var(--fz)); color: var(--muted); }
.rv-rep p { color: var(--ink); font-size: calc(12.5px * var(--fz)); margin-top: 2px; }
.rv-rbtn { font-size: calc(11.5px * var(--fz)); margin-top: 4px; }
.rv-empty { margin: auto; padding: 30px 20px; text-align: center; color: var(--muted); font-size: calc(13px * var(--fz)); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.rv-send { border-top: 1px solid var(--line); padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; bottom: 0; background: var(--panel); }
.rv-send select, .rv-send textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--field); color: var(--ink); font: inherit; font-size: calc(12.5px * var(--fz)); padding: 6px 8px; resize: vertical; }
.rv-sendrow { display: flex; align-items: center; gap: 6px; } .rv-sendrow .sp { flex: 1; } .rv-sendrow label { cursor: pointer; }
.rv-att { display: flex; flex-wrap: wrap; gap: 6px; } .rv-att:empty { display: none; } .rv-att span { position: relative; }
.rv-att img { width: 48px; height: 48px; object-fit: cover; border-radius: var(--r-sm); display: block; }
.rv-att button { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: var(--inv); color: var(--on-inv); display: grid; place-items: center; cursor: pointer; padding: 0; }
@media (max-width: 1180px) { .rvw { grid-template-columns: 250px 1fr 320px; } }
/* Chấm thông báo ở bước Duyệt: số góp ý mới, màu cam nổi bật */
.flow li[data-flow="share"] { position: relative; }
.flow li[data-flow="share"] .sh-badge { position: absolute; top: -5px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: var(--r-pill); background: var(--coral); color: var(--on-dark); font-size: calc(10.5px * var(--fz)); font-weight: 700; font-style: normal; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--panel); }

body.rv-open .fb-bub, body.rv-open .fb-box { display: none; } /* trang Duyệt: nút góp ý nổi che ô trả lời khách */
/* Trang chủ app › Tài nguyên đã tải lên (home.js renderAssets): font, màu */
.h-fonts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.h-font { position: relative; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; background: var(--panel); display: flex; flex-direction: column; gap: 6px; }
.h-font b { font-size: 26px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .h-font small { color: var(--muted); }
.h-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-bottom: 10px; }
.h-color { position: relative; border: 1px solid var(--line); border-radius: var(--r-md); padding: 6px; background: var(--panel); display: flex; flex-direction: column; gap: 4px; align-items: center; }
.h-color span { width: 100%; aspect-ratio: 1.4; border-radius: var(--r-sm); border: 1px solid var(--line); } .h-color small { font-size: calc(12px * var(--fz)); }
.h-colpick { position: relative; overflow: hidden; } .h-colpick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.h-hex { width: 110px; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); color: var(--ink); text-transform: uppercase; }
/* Thanh kéo chung (23/10/2026): rãnh mảnh 4px, phần đã kéo tô màu nhấn, núm tròn nền panel viền nhấn — một kiểu ở app và website.
   --p (phần trăm đã kéo) do js/theme-boot.js tự cập nhật; đổi màu phần đã kéo: --rng. Thanh tự vẽ dải màu riêng (.lfx-r, .pc-sl, style="background…") giữ kiểu của nó. */
:where(input[type=range]:not(.lfx-r, .pc-sl input, [style*="background"])) { -webkit-appearance: none; appearance: none; height: 18px; margin: 0; padding: 0; background: transparent; cursor: pointer; accent-color: var(--rng, var(--accent)); }
:where(input[type=range]:not(.lfx-r, .pc-sl input, [style*="background"]))::-webkit-slider-runnable-track { height: 4px; border-radius: var(--r-pill); background: linear-gradient(to right, var(--rng, var(--accent)) 0 var(--p, 0%), var(--line-strong) var(--p, 0%) 100%); }
:where(input[type=range]:not(.lfx-r, .pc-sl input, [style*="background"]))::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--panel); border: 2px solid var(--rng, var(--accent)); box-shadow: var(--shadow-1); transition: transform .12s cubic-bezier(.16, 1, .3, 1); }
:where(input[type=range]:not(.lfx-r, .pc-sl input, [style*="background"]))::-moz-range-track { height: 4px; border-radius: var(--r-pill); background: var(--line-strong); }
:where(input[type=range]:not(.lfx-r, .pc-sl input, [style*="background"]))::-moz-range-progress { height: 4px; border-radius: var(--r-pill); background: var(--rng, var(--accent)); }
:where(input[type=range]:not(.lfx-r, .pc-sl input, [style*="background"]))::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--panel); border: 2px solid var(--rng, var(--accent)); box-shadow: var(--shadow-1); }
:where(input[type=range]:not(.lfx-r, .pc-sl input, [style*="background"])):hover::-webkit-slider-thumb { transform: scale(1.18); }
:where(input[type=range]:not(.lfx-r, .pc-sl input, [style*="background"])):focus-visible { outline: none; }
:where(input[type=range]:not(.lfx-r, .pc-sl input, [style*="background"])):focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-soft); }
:where(input[type=range]):disabled { opacity: .45; cursor: default; }
/* Hướng dẫn nhanh (js/tour.js): vùng đang giới thiệu sáng, phần còn lại tối mờ; thẻ lời cạnh vùng đó */
.tour { position: fixed; inset: 0; z-index: 300; }
.tour-hole { position: fixed; border-radius: var(--r-md); box-shadow: 0 0 0 9999px rgba(8, 12, 20, .62), 0 0 0 2px var(--accent); transition: all .3s cubic-bezier(.16, 1, .3, 1); pointer-events: none; }
.tour-card { position: fixed; width: min(340px, calc(100vw - 24px)); background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 18px 18px 14px; font-family: var(--font-ui); transition: left .3s cubic-bezier(.16, 1, .3, 1), top .3s cubic-bezier(.16, 1, .3, 1); }
.tour-step { font-size: calc(11.5px * var(--fz)); font-weight: 600; color: var(--accent-ink); margin-bottom: 4px; }
.tour-card h4 { margin: 0 0 6px; font-size: calc(15px * var(--fz)); font-weight: 600; }
.tour-card p { margin: 0 0 14px; font-size: calc(13px * var(--fz)); line-height: 1.5; color: var(--ink-3); }
.tour-act { display: flex; align-items: center; gap: 6px; } .tour-act .sp { flex: 1; }
@media (prefers-reduced-motion: reduce) { .tour-hole, .tour-card { transition: none; } }
/* Chào mừng + chọn mẫu hộp lần đầu vào Studio (js/start-pick.js) — hộp lớn, thư viện mẫu cuộn ngay trong hộp */
.start-pick { z-index: 130; }
.sp-box { width: min(1180px, calc(100vw - 32px)); height: min(860px, calc(100vh - 32px)); display: flex; flex-direction: column; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); overflow: hidden; }
.sp-head { position: relative; display: flex; align-items: flex-start; gap: 16px; padding: 28px 32px 18px; background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--lav) 14%, transparent) 60%, transparent); }
.sp-head > div { flex: 1; min-width: 0; }
.sp-head h2 { margin: 0 0 8px; font-size: calc(24px * var(--fz)); font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
.sp-head p { margin: 0 0 4px; font-size: calc(14px * var(--fz)); line-height: 1.55; color: var(--ink-3); max-width: 78ch; } .sp-head p b { color: var(--accent-ink); }
.sp-head .sp-more { color: var(--muted); font-size: calc(13px * var(--fz)); } .sp-more a { color: var(--accent-ink); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 3px; }
/* Hộp đầu tiên 1 bấm: tên sản phẩm + thương hiệu → 3 gợi ý mẫu có thiết kế sẵn */
.sp-quick { padding: 14px 32px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; } .sp-quick > b { font-size: calc(14px * var(--fz)); font-weight: 600; }
.sp-quick-in { display: flex; flex-wrap: wrap; gap: 10px; } .sp-quick-in input { flex: 2 1 260px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--field); color: var(--ink); font: 500 calc(13.5px * var(--fz)) var(--font-ui); }
.sp-quick-in input + input { flex: 1 1 160px; } .sp-quick-in input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sp-ideas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } .sp-idea { text-decoration: none; color: inherit; } .sp-idea small { color: var(--muted); }
@media (max-width: 640px) { .sp-ideas { grid-template-columns: 1fr; } .sp-quick { padding: 12px 16px; } }
.sp-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 32px; border-bottom: 1px solid var(--line); }
.sp-search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; min-width: 260px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--field); color: var(--muted); }
.sp-search input { flex: 1; border: 0; background: none; outline: none; color: var(--ink); font: 500 calc(13.5px * var(--fz)) var(--font-ui); }
.sp-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sp-chips { display: flex; flex-wrap: wrap; gap: 6px; } .sp-chips .chip.on { background: var(--sel-bg); color: var(--sel-ink); border-color: var(--accent-line); }
.sp-grid { flex: 1; min-height: 0; overflow: auto; padding: 18px 32px 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; align-content: start; }
.sp-card { text-align: left; } .sp-card:hover { border-color: var(--accent); box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 18%, transparent); }
.sp-empty { grid-column: 1 / -1; color: var(--muted); text-align: center; padding: 40px 0; }
.sp-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 32px; border-top: 1px solid var(--line); } .sp-foot small { color: var(--muted); }
@media (max-width: 720px) { .sp-head, .sp-filter, .sp-grid, .sp-foot { padding-left: 16px; padding-right: 16px; } .sp-search { min-width: 0; flex: 1; } .sp-grid { grid-template-columns: repeat(2, 1fr); } }
/* Thanh toán một bước (js/checkout.js): gói bên trái, mã VietQR bên phải — dùng ở app và trang Bảng giá */
.ck-wrap { position: fixed; inset: 0; z-index: 210; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--bg) 55%, rgba(8, 12, 20, .6)); }
.ck { width: min(820px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); font-family: var(--font-ui); }
.ck > header { display: flex; align-items: center; gap: 12px; padding: 18px 22px 6px; } .ck > header h3 { flex: 1; margin: 0; font-size: calc(17px * var(--fz)); font-weight: 600; }
.ck-b { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 20px; padding: 12px 22px 20px; }
.ck-l.dim { opacity: .5; pointer-events: none; }
.ck-plans { display: flex; flex-direction: column; gap: 8px; }
.ck-plan { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: left; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; transition: border-color .15s, background .15s; }
.ck-plan:hover { border-color: var(--accent-line); }
.ck-plan.on { background: var(--sel-bg); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ck-dot { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); }
.ck-plan.on .ck-dot { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 4px, transparent 5px); }
.ck-n { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ck-n b { font-size: calc(14px * var(--fz)); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.ck-n em { font-style: normal; font-size: calc(11px * var(--fz)); font-weight: 600; padding: 1px 8px; border-radius: var(--r-pill); background: var(--grad-lav); color: var(--ink); }
.ck-n small { font-size: calc(12px * var(--fz)); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ck-p { text-align: right; display: grid; justify-items: end; line-height: 1.2; } .ck-p b { font-size: calc(16px * var(--fz)); font-weight: 700; } .ck-p small { font-size: calc(11.5px * var(--fz)); color: var(--muted); }
.ck-p s, .ck-amt s { font-size: calc(12px * var(--fz)); color: var(--muted); }
.ck-promo { display: flex; gap: 8px; margin-top: 12px; }
.ck-promo input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--field); color: var(--ink); font: 500 calc(13px * var(--fz)) var(--font-ui); text-transform: uppercase; } .ck-promo input::placeholder { text-transform: none; }
.ck-promo input:focus { outline: none; border-color: var(--accent); }
.ck-msg { min-height: 1.2em; margin: 6px 0 0; font-size: calc(12px * var(--fz)); } .ck-msg.ok { color: var(--accent-ink); } .ck-msg.err { color: var(--danger); }
.ck-r { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px; border-radius: var(--r-md); background: var(--panel-2); border: 1px solid var(--line); min-height: 320px; }
.ck-qr { width: 200px; aspect-ratio: 1; border-radius: var(--r-md); background: #fff; display: grid; place-items: center; overflow: hidden; } /* nền trắng cố định: app ngân hàng cần nền sáng để quét mã */
.ck-qr img { width: 100%; height: 100%; object-fit: contain; } .ck-qr span { display: grid; justify-items: center; gap: 6px; color: var(--muted); font-size: calc(12px * var(--fz)); }
.ck-amt { display: grid; justify-items: center; line-height: 1.25; } .ck-amt b { font-size: calc(22px * var(--fz)); font-weight: 700; } .ck-amt small { font-size: calc(12px * var(--fz)); color: var(--muted); }
.ck-info { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; width: 100%; font-size: calc(12px * var(--fz)); }
.ck-info dt { color: var(--muted); } .ck-info dd { margin: 0; display: flex; align-items: center; gap: 4px; min-width: 0; overflow-wrap: anywhere; } .ck-info code { font: 700 calc(13px * var(--fz)) var(--font-mono); color: var(--accent-ink); }
.ck-info .icon-btn.sm { width: 24px; height: 24px; }
.ck-wait { display: flex; align-items: center; gap: 8px; margin: auto 0 0; font-size: calc(12px * var(--fz)); color: var(--muted); text-align: center; }
.ck-spin { flex: none; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent-line); border-top-color: var(--accent); animation: ck-spin .9s linear infinite; }
@keyframes ck-spin { to { transform: rotate(360deg); } }
.ck-load { margin: auto; color: var(--muted); font-size: calc(13px * var(--fz)); display: grid; justify-items: center; gap: 8px; text-align: center; } .ck-load.err { color: var(--danger); }
.ck-ok { margin: auto; display: grid; justify-items: center; gap: 6px; text-align: center; } .ck-ok > svg { width: 44px; height: 44px; color: var(--ok); } .ck-ok b { font-size: calc(17px * var(--fz)); } .ck-ok small { color: var(--muted); margin-bottom: 8px; }
.ck > footer { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 22px 18px; border-top: 1px solid var(--line); }
@media (max-width: 720px) { .ck-b { grid-template-columns: 1fr; } .ck-r { min-height: 0; } }
@media (prefers-reduced-motion: reduce) { .ck-spin { animation: none; } }
/* Bước 1 của thanh toán (tài khoản miễn phí / Cơ bản hết lượt): thẻ gói như trang Bảng giá, chuyển sang bước mã QR ngay trong hộp */
.ck.wide { width: min(980px, 100%); }
.ck-intro, .ck-b { animation: ck-in .28s cubic-bezier(.16, 1, .3, 1); }
@keyframes ck-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.ck-intro { padding: 10px 22px 20px; }
.ck-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.ck-card { font: inherit; color: var(--ink); text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.ck-card:hover { transform: translateY(-2px); }
.ck-card.on { border: 2px solid var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 18px 44px color-mix(in srgb, var(--accent) 18%, transparent); }
.ck-card .price s { display: block; font-size: calc(13px * var(--fz)); font-weight: 500; color: var(--muted); }
.ck-card .ck-dot { position: absolute; right: 14px; bottom: 14px; }
.ck-card.on .ck-dot { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 4px, transparent 5px); }
.ck-ibar { display: flex; align-items: flex-start; gap: 12px; margin-top: 16px; } .ck-slot { flex: 1; min-width: 0; } .ck-slot .ck-promo { margin-top: 0; max-width: 420px; }
.ck-next { height: 42px; padding: 0 20px; }
.ck-back { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; font-size: calc(13px * var(--fz)); }
@media (max-width: 720px) { .ck-ibar { flex-direction: column; align-items: stretch; } }
@media (prefers-reduced-motion: reduce) { .ck-intro, .ck-b { animation: none; } }
.ck-feats { list-style: none; margin: 12px 0 0; padding: 0 4px; display: grid; gap: 8px; font-size: calc(13px * var(--fz)); color: var(--ink-3); } .ck-feats li { display: flex; gap: 8px; } .ck-feats svg { flex: none; margin-top: 2px; color: var(--accent-ink); }

/* ---------- Tự dựng khuôn (0.17.46): thanh công cụ kiểu Design, bảng chi tiết kiểu Layers ---------- */
.dt-grp { display: flex; flex-direction: column; gap: 3px; } .dt-grp[hidden] { display: none; }
/* chú thích nổi bên phải nút: tên + phím tắt (hiện ngay, không đợi title của trình duyệt) */
.dt-col button[data-tip]::after { content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translate(-4px, -50%); opacity: 0; pointer-events: none; white-space: nowrap; background: var(--inv); color: var(--on-inv); font: 600 calc(12px * var(--fz)) var(--font-ui); padding: 5px 9px; border-radius: var(--r-sm); box-shadow: var(--shadow-2); transition: opacity .12s, transform .12s; z-index: 3; }
.dt-col button[data-k]::after { content: attr(data-tip) "   " attr(data-k); }
.dt-col button[data-tip]:hover::after { opacity: 1; transform: translate(0, -50%); transition-delay: .2s; }
.dt-oh { font-size: calc(12px * var(--fz)); font-weight: 700; color: var(--ink); padding: 3px 4px 7px; }
.dt-keys { margin: 7px 2px 1px; font-size: calc(11px * var(--fz)); color: var(--muted); white-space: nowrap; }
.dt-keys kbd { font: 600 calc(10px * var(--fz)) var(--font-ui); background: var(--field); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; color: var(--ink); }
#flapOpts .dt-keys { margin-top: 0; }

.cb-add { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cb-add button { display: grid; justify-items: center; gap: 5px; padding: 10px 2px 8px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); color: var(--ink); cursor: pointer; font: 600 calc(11px * var(--fz)) var(--font-ui); transition: border-color .15s, background .15s; }
.cb-add button svg.ic { width: 22px; height: 22px; }
.cb-add button span { white-space: nowrap; }
.cb-add button:hover { border-color: var(--accent-line); background: var(--hover); }
.cb-add button.on { background: var(--sel-bg); color: var(--sel-ink); border-color: var(--accent); }
.cb-head { display: flex; align-items: center; gap: 6px; margin: 16px 0 6px; font-size: calc(12px * var(--fz)); font-weight: 700; color: var(--ink); }
.cb-head > span:first-child { flex: 1; display: flex; align-items: center; gap: 6px; }
.cb-cnt { font-size: calc(11px * var(--fz)); font-weight: 600; color: var(--muted); }
.cb-cnt:not(:empty) { background: var(--field); border-radius: var(--r-pill); padding: 0 7px; }
.cb-acts { display: inline-flex; gap: 2px; }
.cb-head .icon-btn[hidden] { display: none; }

.cl-tree { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel-2); max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.cl-face { display: flex; align-items: center; gap: 7px; padding: 5px 6px 3px; font-size: calc(11px * var(--fz)); font-weight: 700; color: var(--muted); cursor: pointer; border-radius: var(--r-sm); }
.cl-face:not(:first-child) { margin-top: 4px; }
.cl-face:hover, .cl-face.on { color: var(--ink); }
.cl-face .cbar { width: 3px; height: 12px; border-radius: 2px; background: var(--accent); }
.cl-face .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-face .cnt { font-weight: 600; }
.crow { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border-radius: var(--r-sm); cursor: pointer; }
.crow:hover { background: var(--hover); }
.crow.on { background: var(--sel-bg); color: var(--sel-ink); }
.crow .lth { flex: none; width: 26px; height: 26px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); color: var(--muted); }
.crow.on .lth { color: var(--sel-ink); border-color: var(--accent); }
.crow .lth.k-holes { color: var(--danger); } .crow .lth.k-locks { color: var(--lav-ink); } .crow .lth.k-flaps { color: var(--accent-ink); }
.crow .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: calc(12px * var(--fz)); font-weight: 600; line-height: 1.25; }
.crow .nm, .crow .nm small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow .nm small { font-size: calc(10.5px * var(--fz)); font-weight: 500; color: var(--muted); }
.crow.on .nm small { color: inherit; opacity: .75; }
.crow .wn { color: var(--danger); display: grid; }
.crow.warn .lth { border-color: var(--danger); }
.crow > button[data-del] { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 4px; border-radius: var(--r-sm); opacity: 0; display: grid; }
.crow:hover > button[data-del], .crow.on > button[data-del] { opacity: 1; }
.crow > button[data-del]:hover { color: var(--danger); background: var(--danger-soft); }
.crow.removed { cursor: default; } .crow.removed .nm { color: var(--muted); }
.cl-empty { padding: 14px 8px; text-align: center; font-size: calc(11.5px * var(--fz)); color: var(--muted); }

.cb-check { display: flex; align-items: center; gap: 6px; margin-top: 14px; padding: 6px 6px 6px 10px; border-radius: var(--r-md); background: var(--field); }
.cb-check .cb-st { flex: 1; display: flex; align-items: center; gap: 7px; font-size: calc(12px * var(--fz)); }
.cb-check .cb-st b { font-weight: 600; }
.cb-check.ok { background: var(--accent-soft); } .cb-check.ok .cb-st svg.ic { color: var(--accent-ink); }
.cb-check.warn { background: var(--warn-soft); } .cb-check.warn .cb-st svg.ic { color: var(--warn-ink); }
.cb-check.bad { background: var(--danger-soft); } .cb-check.bad .cb-st svg.ic { color: var(--danger); }
.cb-check #ruleFix[hidden] { display: none; }

.cb-fold { margin-bottom: 6px; }
.cb-fold .btn svg.ic { width: 14px; height: 14px; }
.seq-step { border: 1px solid var(--line); border-radius: var(--r-md); padding: 3px; background: var(--panel); }
.seq-head { display: flex; align-items: center; gap: 7px; font-size: calc(11.5px * var(--fz)); font-weight: 700; color: var(--muted); padding: 4px 6px; cursor: pointer; border-radius: var(--r-sm); }
.seq-head svg.ic { margin-left: auto; opacity: 0; }
.seq-head:hover { color: var(--ink); background: var(--hover); } .seq-head:hover svg.ic { opacity: 1; }
.seq-n { font-style: normal; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--field); color: var(--ink); font-size: calc(10px * var(--fz)); }
.seq-row button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 3px; border-radius: var(--r-sm); display: grid; opacity: 0; }
.seq-row:hover button, .seq-row.on button { opacity: 1; }
.seq-row button:hover { background: var(--line); color: var(--ink); }
.seq-gap svg.ic { width: 11px; height: 11px; }
#refBox > summary svg.ic { width: 15px; height: 15px; color: var(--muted); }
