@font-face { font-family: "BVP"; src: url("vendor/fonts/BeVietnamPro-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "BVP"; src: url("vendor/fonts/BeVietnamPro-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
:root {
	/* bàn làm việc tối (theo mẫu): thanh menu, thanh công cụ và các khung dock xanh đen; màu nhấn xanh lam.
	   Muốn đổi màu nhấn chỉ cần sửa 4 biến --ac*. */
	--bg0: #060a11; --chrome: #0b121e; --pnl: #0e1726; --pnl-h: #121d30;
	--chrome-2: #17233a; --chrome-3: #20304e; --line: rgba(130, 165, 215, .17);
	--tx: #e4ecf7; --mu: #93a3bb; --mu2: #66768e;
	--canvas: #05080e;
	--ac: #3bc3ef; --ac-ink: #8fdcf7; --ac-soft: rgba(59, 195, 239, .14); --ac-line: rgba(59, 195, 239, .55); --ac-on: #04222d;
	--bad: #e5565b; --ok: #58b47f;
	--r: 11px; --r-sm: 7px; --bar: 52px; --mbar: 40px; --ph: 36px;
	--pg-sh: 0 12px 34px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg0); color: var(--tx); font: 14px/1.45 "BVP", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; border-radius: 4px; }
#app { display: flex; flex-direction: column; height: 100%; min-height: 0; }

/* ---- thanh menu ---- */
.menubar { display: flex; align-items: center; gap: 2px; padding: 0 10px; min-height: var(--mbar); background: var(--chrome); border-bottom: 1px solid var(--line); z-index: 7; flex: none; }
.brand { display: flex; align-items: center; padding: 0 12px 0 4px; }
.brand svg { display: block; }
.mbi { height: 32px; padding: 0 13px; border: 0; background: none; color: var(--tx); border-radius: var(--r-sm); cursor: pointer; font-size: 14.5px; white-space: nowrap; }
.mbi:hover, .mbi[aria-expanded="true"] { background: var(--chrome-2); }
.mb-sp { flex: 1; }
.langsw { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--pnl); }
.langsw button { display: flex; align-items: center; justify-content: center; width: 38px; height: 26px; padding: 0; border: 1px solid transparent; border-radius: 6px; background: none; cursor: pointer; opacity: .55; transition: opacity .12s, background .12s; }
.langsw button:hover { opacity: .9; }
.langsw button[aria-pressed="true"] { opacity: 1; background: var(--chrome-3); border-color: var(--ac-line); }
.langsw svg { display: block; border-radius: 2px; }

/* ---- thanh công cụ ---- */
.bar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--chrome); border-bottom: 1px solid var(--line); min-height: var(--bar); flex-wrap: wrap; z-index: 6; flex: none; }
.grp { display: flex; align-items: center; gap: 5px; }
.grp.tools { flex: 1; justify-content: center; flex-wrap: nowrap; min-width: 0; }
.grp.right { gap: 7px; }

.btn, .tool { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border: 1px solid transparent; background: transparent; color: var(--tx); border-radius: var(--r-sm); cursor: pointer; white-space: nowrap; transition: background .13s, border-color .13s, color .13s; }
.btn { border-color: var(--line); background: var(--chrome-2); }
.btn:hover:not(:disabled), .tool:hover { background: var(--chrome-3); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--ac); border-color: var(--ac); color: var(--ac-on); font-weight: 700; }
.btn.primary:hover:not(:disabled) { background: var(--ac-ink); }
.btn.danger { color: #ffb4b6; border-color: rgba(229, 86, 91, .4); background: transparent; }
.btn.danger:hover:not(:disabled) { background: rgba(229, 86, 91, .14); }
.btn.sm { height: 30px; padding: 0 9px; font-size: 13px; }
.tool { color: var(--mu); }
.tool:hover { color: var(--tx); }
.tool.on { background: var(--ac); color: var(--ac-on); font-weight: 700; }
.tool.on:hover { background: var(--ac-ink); color: var(--ac-on); }
#zoomLbl { min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; color: var(--mu); font-size: 13px; }
.grp.right #bZoomIn, .grp.right #bZoomOut { font-size: 17px; padding: 0 11px; }

.ic { width: 18px; height: 18px; display: inline-block; background: currentColor; flex: none;
	-webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.ic-open { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7v12a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-7l-2-3H5a2 2 0 0 0-2 2z'/%3E%3C/svg%3E"); }
.ic-plus { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.ic-undo { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 14 4 9l5-5'/%3E%3Cpath d='M4 9h10a6 6 0 0 1 0 12h-3'/%3E%3C/svg%3E"); }
.ic-redo { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 14 5-5-5-5'/%3E%3Cpath d='M20 9H10a6 6 0 0 0 0 12h3'/%3E%3C/svg%3E"); }
.ic-cursor { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M5 3l14 7-6 2-2 6z'/%3E%3C/svg%3E"); }
.ic-text { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M5 6V4h14v2M12 4v16M9 20h6'/%3E%3C/svg%3E"); }
.ic-edit { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4L19 9l-4-4L4 16z'/%3E%3Cpath d='M13 7l4 4'/%3E%3C/svg%3E"); }
.ic-pen { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 17c3-5 5 3 8-2s4-9 7-5 1 8 3 8'/%3E%3C/svg%3E"); }
.ic-hl { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='8' width='18' height='8' rx='1' fill='black' opacity='.55'/%3E%3Cpath d='M3 20h18' stroke='black' stroke-width='2'/%3E%3C/svg%3E"); }
.ic-white { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='4' y='6' width='16' height='12' rx='1'/%3E%3C/svg%3E"); }
.ic-black { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='4' y='6' width='16' height='12' rx='1' fill='black'/%3E%3C/svg%3E"); }
.ic-image { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Ccircle cx='9' cy='10' r='2'/%3E%3Cpath d='m21 16-5-5-9 9'/%3E%3C/svg%3E"); }
.ic-sign { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3 16c2-6 4-10 5-8s-3 10 0 9 4-7 6-5 0 5 2 4 3-3 5-2'/%3E%3Cpath d='M3 21h18'/%3E%3C/svg%3E"); }
.ic-save { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12m0 0 4-4m-4 4-4-4M5 21h14'/%3E%3C/svg%3E"); }
.ic-stamp { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4 7 20M17 4l-2 16M4 9h16M3.5 15h16'/%3E%3C/svg%3E"); }
.ic-shape { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='7' cy='7' r='4'/%3E%3Cpath d='M13 21 20 14M20 14h-5M20 14v5'/%3E%3C/svg%3E"); }
.ic-search { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.2-3.2'/%3E%3C/svg%3E"); }
.ic-chev { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.ic-chev.up { transform: rotate(180deg); }
.ic-max { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linejoin='round'%3E%3Crect x='5' y='5' width='14' height='14' rx='1.5'/%3E%3C/svg%3E"); }
.ic-restore { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linejoin='round'%3E%3Crect x='4.5' y='8.5' width='11' height='11' rx='1.5'/%3E%3Cpath d='M8.5 8.5v-3a1.5 1.5 0 0 1 1.5-1.5h8.5A1.5 1.5 0 0 1 20 5.5V14a1.5 1.5 0 0 1-1.5 1.5h-3'/%3E%3C/svg%3E"); }
.ic-close { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E"); }
.ic-fit { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h16M7 8l-3 4 3 4M17 8l3 4-3 4'/%3E%3C/svg%3E"); }

/* ---- menu thả xuống ---- */
.dd { position: fixed; z-index: 50; background: var(--pnl); color: var(--tx); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 18px 44px rgba(0, 0, 0, .62); padding: 5px; min-width: 250px; max-height: calc(100vh - 60px); overflow: auto; }
.dd button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 8px 11px; color: inherit; cursor: pointer; white-space: nowrap; }
.dd button:hover:not(:disabled), .dd button:focus-visible { background: var(--chrome-3); outline: none; }
.dd button:disabled { opacity: .38; cursor: default; }
.dd .chk { width: 14px; color: var(--ac-ink); font-size: 13px; flex: none; text-align: center; }
.dd .kb { margin-left: auto; padding-left: 22px; color: var(--mu2); font-size: 12px; }
.dd .mdiv { height: 1px; background: var(--line); margin: 5px 4px; }

/* ---- vùng dock ---- */
.dock { flex: 1; min-height: 0; display: grid; position: relative; background: var(--bg0);
	grid-template-areas: "left spl doc spr right";
	grid-template-columns: 232px 5px minmax(0, 1fr) 5px 300px; grid-template-rows: minmax(0, 1fr); }
#side { grid-area: left; } #spL { grid-area: spl; } #docp { grid-area: doc; } #spR { grid-area: spr; } #rside { grid-area: right; }
.pnl { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--pnl); overflow: hidden; border: 1px solid var(--line); }
.pnl.off { display: none; }
.split { background: var(--bg0); position: relative; z-index: 2; }
.split.v { cursor: col-resize; } .split.h { cursor: row-resize; }
.split::after { content: ""; position: absolute; background: transparent; transition: background .12s; }
.split.v::after { inset: 0 1px; } .split.h::after { inset: 1px 0; }
.split:hover::after, .split:focus-visible::after, .split.drag::after { background: var(--ac); }
.split:focus-visible { outline: none; }
.dock.dragging-split { user-select: none; }
.dock.dragging-split iframe, .dock.dragging-split .pg { pointer-events: none; }

.ph { display: flex; align-items: stretch; flex: none; height: var(--ph); background: var(--pnl-h); border-bottom: 1px solid var(--line); min-width: 0; }
.ph .ptab, .ph .ptabs button { display: flex; align-items: center; gap: 8px; padding: 0 14px; background: var(--pnl); color: var(--tx); border: 0; border-top: 2px solid var(--ac); font-size: 14px; white-space: nowrap; }
.ph .ptabs { display: flex; min-width: 0; overflow: hidden; }
.ph .ptabs button { cursor: pointer; background: none; border-top-color: transparent; color: var(--mu); }
.ph .ptabs button:hover { color: var(--tx); }
.ph .ptabs button[aria-selected="true"] { background: var(--pnl); border-top-color: var(--ac); color: var(--tx); }
.ph .ptab { max-width: 46%; overflow: hidden; text-overflow: ellipsis; }
.ph .ptabs .ptab { max-width: none; flex: none; }
.pnl-doc .ph .ptab { max-width: 60%; }
#pgCount { align-self: center; margin-left: 10px; color: var(--mu); font-size: 12px; white-space: nowrap; }
.pbtns { margin-left: auto; display: flex; align-items: center; gap: 2px; padding: 0 6px; }
.pbtn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--mu); cursor: pointer; }
.pbtn:hover:not(:disabled) { background: var(--chrome-3); color: var(--tx); }
.pbtn:disabled { opacity: .35; cursor: default; }
.pbtn .ic { width: 15px; height: 15px; }
.docnav { display: flex; align-items: center; gap: 2px; margin-left: 12px; color: var(--mu); font-size: 13px; font-variant-numeric: tabular-nums; }
#curPg { min-width: 54px; text-align: center; }
.pbody { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* khung thu gọn: cạnh trái/phải thành một thanh hẹp, khung dưới chỉ còn tiêu đề */
.pnl.coll .pbody { display: none; }
.pnl.coll[data-panel="bottom"] { height: var(--ph); }
.pnl.coll[data-panel="pages"], .pnl.coll[data-panel="props"] { width: 34px; }
.pnl.coll[data-panel="pages"] .ph, .pnl.coll[data-panel="props"] .ph { flex-direction: column; height: 100%; width: 100%; border-bottom: 0; align-items: center; padding-top: 6px; gap: 10px; }
.pnl.coll[data-panel="pages"] .ptab, .pnl.coll[data-panel="props"] .ptab { writing-mode: vertical-rl; padding: 12px 0; border-top: 0; border-left: 2px solid var(--ac); max-width: none; background: none; order: 2; }
.pnl.coll[data-panel="pages"] #pgCount { display: none; }
.pnl.coll[data-panel="pages"] .pbtns, .pnl.coll[data-panel="props"] .pbtns { order: 1; flex-direction: column; margin: 0; padding: 0; }
.pnl.coll[data-panel="pages"] .pbtn:not([data-pact="collapse"]), .pnl.coll[data-panel="props"] .pbtn:not([data-pact="collapse"]) { display: none; }
.pnl.coll[data-panel="pages"] [data-pact="collapse"] .ic { transform: rotate(-90deg); }
.pnl.coll[data-panel="props"] [data-pact="collapse"] .ic { transform: rotate(90deg); }
.pnl.coll[data-panel="bottom"] [data-pact="collapse"] .ic { transform: rotate(180deg); }

/* ---- khung Trang ---- */
.findbox { padding: 10px 10px 8px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.frow { display: flex; align-items: center; gap: 6px; }
.frow .ic-search { position: absolute; margin-left: 9px; width: 15px; height: 15px; color: var(--mu2); pointer-events: none; }
.findbox input { width: 100%; height: 32px; border: 1px solid var(--line); border-radius: 6px; background: #080e19; color: var(--tx); padding: 0 9px 0 31px; outline: none; }
.findbox input::placeholder { color: var(--mu2); }
.findbox input:focus { border-color: var(--ac-line); }
.fctl { justify-content: flex-end; }
#findCount { flex: 1; font-size: 12px; color: var(--mu); }
.fctl .btn.sm { height: 26px; min-width: 28px; padding: 0 7px; }
.pacts { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); }
.pacts .btn { background: var(--chrome-2); }
.thumbs { flex: 1; overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 12px; }
.th { position: relative; border: 1px solid transparent; border-radius: var(--r-sm); padding: 6px 6px 4px; cursor: pointer; text-align: center; user-select: none; transition: background .12s, border-color .12s; }
.th:hover { background: var(--chrome-2); }
.th.sel { border-color: var(--ac-line); background: var(--ac-soft); }
.th.cur canvas { box-shadow: 0 0 0 2px var(--ac), 0 4px 12px rgba(0, 0, 0, .4); }
.th.drag-over { box-shadow: inset 0 3px 0 var(--ac); }
.th canvas { max-width: 100%; border-radius: 2px; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); background: #fff; display: block; margin: 0 auto; }
.th .n { font-size: 12px; color: var(--mu); margin-top: 5px; }
.th .ck { position: absolute; top: 9px; left: 9px; width: 17px; height: 17px; accent-color: var(--ac); cursor: pointer; }
#app.empty .pacts .btn { opacity: .45; pointer-events: none; }

/* ---- khung Thuộc tính ---- */
#rside .pbody { overflow: auto; }
.psec { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.psec:last-child { border-bottom: 0; }
.plabel { color: var(--mu); font-size: 12.5px; margin-bottom: 6px; }
.pname { font-size: 18px; font-weight: 700; line-height: 1.25; word-break: break-word; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; margin: 0; }
.kv dt { color: var(--tx); }
.kv dd { margin: 0; text-align: right; color: var(--tx); font-variant-numeric: tabular-nums; word-break: break-word; }
.props { display: flex; flex-direction: column; gap: 11px; font-size: 13.5px; color: var(--mu); }
.props label { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--tx); }
.props select { height: 30px; min-width: 120px; border: 1px solid var(--line); border-radius: 6px; background: #080e19; color: var(--tx); padding: 0 6px; }
.props input[type=color] { width: 56px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #080e19; cursor: pointer; }
.props input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--ac); flex: none; }
.props label.pb, .props label.pr { justify-content: flex-start; align-items: flex-start; }
.props .btn.danger { align-self: flex-start; }

/* ---- khung dưới ---- */

/* ---- vùng tài liệu ---- */
.view { flex: 1; min-height: 0; overflow: auto; position: relative; background: var(--canvas); }
.pages { padding: 28px 24px 48px; display: flex; flex-direction: column; align-items: center; gap: 26px; }
.pg { position: relative; background: #fff; border-radius: 2px; box-shadow: var(--pg-sh); flex: none; touch-action: pan-x pan-y; }
.pg canvas.r { position: absolute; inset: 0; width: 100%; height: 100%; }
.pg svg.ov { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.pg .tl { position: absolute; inset: 0; }
.pg .fl { position: absolute; inset: 0; pointer-events: none; }
.pg .pnum { position: absolute; right: 0; bottom: -24px; font-size: 12px; color: var(--mu); font-variant-numeric: tabular-nums; }
#app[data-tool=ink] .pg, #app[data-tool=hl] .pg, #app[data-tool=white] .pg, #app[data-tool=black] .pg { touch-action: none; cursor: crosshair; }
#app[data-tool=text] .pg, #app[data-tool=image] .pg, #app[data-tool=sign] .pg { cursor: copy; }

/* text spans for "edit existing text" */
.tl span { position: absolute; color: transparent; white-space: pre; cursor: text; border-radius: 2px; transform-origin: 0 0; }
#app:not([data-tool=edit]) .tl { display: none; }
.tl span:hover { background: rgba(59, 195, 239, .16); outline: 1px solid var(--ac-line); }

/* form fields */
.fl .ff { position: absolute; pointer-events: auto; border: 1px solid rgba(31, 94, 255, .5); background: rgba(225, 236, 255, .5); padding: 0 2px; margin: 0; border-radius: 2px; color: #111; }
.fl input.ff[type=checkbox], .fl input.ff[type=radio] { appearance: auto; accent-color: #1f5eff; }
.fl textarea.ff { resize: none; }

/* overlay objects */
.ov .o, .ov .hdl { pointer-events: auto; cursor: move; touch-action: none; }
#app[data-tool=select] .pg.has-sel { touch-action: none; }
#app:not([data-tool=select]):not([data-tool=edit]) .ov .o { pointer-events: none; }
#app[data-tool=edit] .ov .o { cursor: text; }
.ov .selbox { fill: none; stroke: var(--ac); stroke-dasharray: 4 3; pointer-events: none; }
.ov .hdl { fill: #fff; stroke: var(--ac); cursor: nwse-resize; }
.editor { position: absolute; z-index: 3; border: 1px dashed var(--ac); background: rgba(255, 255, 255, .94); color: #000; outline: none; padding: 0; margin: 0; resize: none; overflow: hidden; white-space: pre; font-family: "BVP"; line-height: 1.265; min-width: 40px; }

/* ---- empty state ---- */
.drop { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; }
#app:not(.empty) .drop { display: none; }
#app.empty .sidebtn { display: none; }
.drop-in { max-width: 460px; text-align: center; }
.hero-art { filter: drop-shadow(0 16px 30px rgba(0, 0, 0, .45)); margin-bottom: 20px; }
.drop-in h1 { margin: 0 0 10px; font-size: 30px; font-weight: 700; letter-spacing: -.01em; color: var(--tx); }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 10px; }
.drop-in .small { margin: 12px 0 0; color: var(--mu2); font-size: 13px; }
.drop-in .priv { margin: 26px auto 0; max-width: 40ch; font-size: 12.5px; color: #8fd0ab; background: rgba(88, 180, 127, .1); border: 1px solid rgba(88, 180, 127, .22); border-radius: 9px; padding: 9px 12px; }
.drop-in .priv.warn { color: #e7c48b; background: rgba(201, 162, 63, .1); border-color: rgba(201, 162, 63, .28); }
.drop-in .priv a { color: inherit; }
#app.dragging .view { box-shadow: inset 0 0 0 2px var(--ac); }
#app.dragging .drop-in { transform: scale(1.01); }
#app.dragging .hero-art { filter: drop-shadow(0 16px 30px rgba(59, 195, 239, .4)); }

/* ---- toast, modal, busy ---- */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--pnl-h); color: var(--tx); padding: 12px 18px 12px 16px; border-radius: 11px; border: 1px solid var(--line); border-left: 3px solid var(--ok); box-shadow: 0 16px 40px rgba(0, 0, 0, .55); z-index: 50; max-width: min(560px, 92vw); font-size: 13.5px; }
.toast.bad { border-left-color: var(--bad); }

.modal-bg { position: fixed; inset: 0; background: rgba(4, 7, 12, .66); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 14px; }
.modal { background: #fff; color: #1b1f27; border-radius: 14px; max-width: 560px; width: 100%; box-shadow: 0 24px 60px rgba(0, 0, 0, .55); overflow: hidden; max-height: 94vh; display: flex; flex-direction: column; }
.modal h2 { margin: 0; padding: 16px 18px; font-size: 16px; border-bottom: 1px solid #e7eaef; }
.modal .mb { padding: 16px 18px; line-height: 1.5; overflow: auto; }
.modal .mf { padding: 12px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid #e7eaef; background: #fafbfc; flex-wrap: wrap; }
.modal .mf .btn { background: #f1f3f6; border-color: #dfe3ea; color: #1b1f27; }
.modal .mf .btn:hover:not(:disabled) { background: #e7eaef; }
.modal .mf .btn.primary { background: var(--ac); border-color: var(--ac); color: var(--ac-on); }
.modal .mf .btn.primary:hover:not(:disabled) { background: #29a9d4; }
.modal input[type=text], .modal input[type=password] { width: 100%; height: 38px; border: 1px solid #d7dce4; border-radius: 9px; padding: 0 11px; color: #1b1f27; background: #fff; }
.modal select { color: #1b1f27; background: #fff; border: 1px solid #d7dce4; border-radius: 8px; height: 32px; }
.modal input[type=number] { color: #1b1f27; background: #fff; }
.sigpad { width: 100%; height: 200px; border: 1px solid #d7dce4; border-radius: 10px; touch-action: none; background: #fff; display: block; }
.busy { position: fixed; inset: 0; background: rgba(5, 8, 14, .6); backdrop-filter: blur(1px); z-index: 60; display: flex; align-items: center; justify-content: center; color: var(--tx); font-weight: 600; }
.modal .mf .btn.danger { background: #fff; border-color: #e6b3b0; color: #c0241c; margin-right: auto; }
.modal .mf .btn.danger:hover:not(:disabled) { background: #fdecea; }
.stmp .rd { display: flex; align-items: center; gap: 9px; padding: 8px 2px; font-size: 14px; color: #2a303b; cursor: pointer; }

/* ---- số trang / dấu chìm dialog ---- */
.stmp .stmp-grid { display: grid; grid-template-columns: auto 1fr 1fr 1fr; gap: 8px; align-items: center; }
.stmp .stmp-grid > span { font-size: 13px; color: #5b6475; font-weight: 600; }
.stmp .stmp-grid input { width: 100%; height: 34px; border: 1px solid #d7dce4; border-radius: 8px; padding: 0 9px; min-width: 0; }
.stmp .stmp-opt { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 14px; align-items: center; }
.stmp .stmp-opt label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #3a4150; }
.stmp .stmp-opt input[type=number] { width: 66px; height: 32px; border: 1px solid #d7dce4; border-radius: 8px; padding: 0 8px; }
.stmp .stmp-opt input[type=range] { width: 120px; }
.stmp .stmp-opt label.ck { gap: 7px; }
.stmp .wm-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #3a4150; }
.stmp .wm-row input { flex: 1; height: 38px; border: 1px solid #d7dce4; border-radius: 9px; padding: 0 11px; }
@media (max-width: 560px) { .stmp .stmp-grid { grid-template-columns: 1fr 1fr 1fr; } .stmp .stmp-grid > span { grid-column: 1 / -1; margin-top: 4px; } }

/* ---- điện thoại / màn hình hẹp: các khung hai bên trượt ra, khung dưới ẩn ---- */
.sidebtn { display: none; }
@media (max-width: 820px) {
	.btn span, .tool span { display: none; }
	.btn, .tool { padding: 0 9px; gap: 0; }
	.btn.lg span { display: inline; }
	.menubar { padding: 0 4px; overflow-x: auto; scrollbar-width: none; }
	.menubar::-webkit-scrollbar { display: none; }
	.brand { display: none; }
	.mb-sp { display: none; }
	.langsw { position: sticky; right: 0; margin-left: auto; flex: none; box-shadow: -10px 0 10px var(--chrome); background: var(--pnl); }
	.mbi { padding: 0 10px; }
	.brand { display: none; }
	.bar { gap: 4px; padding: 4px 8px; }
	.grp.tools { order: 3; width: 100%; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; padding: 2px 0 4px; -webkit-overflow-scrolling: touch; }
	.grp.tools::-webkit-scrollbar { height: 0; }
	.dock { grid-template-areas: "doc" !important; grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: minmax(0, 1fr) !important; }
	.split { display: none !important; }
	#side, #rside { display: flex !important; position: absolute; z-index: 8; top: 0; bottom: 0; width: min(86vw, 300px); box-shadow: 0 0 34px rgba(0, 0, 0, .6); transition: transform .2s ease; }
	#side { left: 0; transform: translateX(-105%); }
	#rside { right: 0; transform: translateX(105%); }
	#side.open, #rside.open { transform: none; }
	#side .pbody, #rside .pbody { display: flex !important; }
	.pnl.coll .pbody { display: flex; }
	#side [data-pact="collapse"], #side [data-pact="max"], #rside [data-pact="collapse"], #rside [data-pact="max"] { display: none; }
	#docp [data-pact="max"] { display: none; }
	.sidebtn { display: inline-flex; position: fixed; bottom: 16px; z-index: 9; background: var(--chrome-2); box-shadow: 0 6px 18px rgba(0, 0, 0, .45); }
	#bSide { left: 12px; } #bProps { right: 12px; }
	.sidebtn span { display: inline; }
	.pages { padding: 14px 8px 72px; gap: 18px; }
	.langsw button { width: 34px; }
}
@media (min-width: 821px) and (max-width: 2100px) {
	.tool span { display: none; }
	.tool { padding: 0 11px; gap: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ================= 1.2 ================= */
.ic-rl { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7'/%3E%3Cpath d='M3 4v5h5'/%3E%3C/svg%3E"); }
.ic-rr { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 1 1-3-6.7'/%3E%3Cpath d='M21 4v5h-5'/%3E%3C/svg%3E"); }
.ic-up { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5'/%3E%3Cpath d='m5 12 7-7 7 7'/%3E%3C/svg%3E"); }
.ic-dn { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14'/%3E%3Cpath d='m19 12-7 7-7-7'/%3E%3C/svg%3E"); }
.ic-dup { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='11' height='11' rx='2'/%3E%3Cpath d='M5 15V6a2 2 0 0 1 2-2h9'/%3E%3C/svg%3E"); }
.ic-blank { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5'/%3E%3Cpath d='M12 11v6M9 14h6'/%3E%3C/svg%3E"); }
.ic-extract { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5'/%3E%3Cpath d='M9 14h6'/%3E%3Cpath d='m13 11 3 3-3 3'/%3E%3C/svg%3E"); }
.ic-split { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6' cy='6' r='3'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Cpath d='M20 4 8.1 15.9M14.5 14.5 20 20M8.1 8.1 12 12'/%3E%3C/svg%3E"); }
.ic-trash { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16'/%3E%3Cpath d='M10 11v6M14 11v6'/%3E%3Cpath d='M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12'/%3E%3Cpath d='M9 7V4h6v3'/%3E%3C/svg%3E"); }
.ic-under { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 4v7a5 5 0 0 0 10 0V4'/%3E%3Cpath d='M5 21h14'/%3E%3C/svg%3E"); }
.ic-strike { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 6a4 4 0 0 0-4-2c-2.5 0-4 1.3-4 3s1.5 2.5 4 3'/%3E%3Cpath d='M4 12h16'/%3E%3Cpath d='M8 18a4 4 0 0 0 4 2c2.5 0 4-1.3 4-3 0-1-.5-1.7-1.5-2.3'/%3E%3C/svg%3E"); }
.ic-check { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E"); }
.ic-alert { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4 2.5 20h19z'/%3E%3Cpath d='M12 10v5M12 18v.01'/%3E%3C/svg%3E"); }

/* ---- nền chung ---- */
* { scrollbar-width: thin; scrollbar-color: rgba(130, 165, 215, .3) transparent; }
::selection { background: rgba(59, 195, 239, .32); }
kbd { font: inherit; font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--mu2); white-space: nowrap; }
.tsep { display: inline-block; width: 1px; height: 20px; background: var(--line); margin: 0 6px; flex: none; }

/* ---- thanh menu: ô tìm lệnh ---- */
.cmdbtn { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px 0 11px; margin-right: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--pnl); color: var(--mu); cursor: pointer; font-size: 13px; transition: border-color .12s, color .12s; }
.cmdbtn:hover { border-color: var(--ac-line); color: var(--tx); }
.cmdbtn .ic { width: 15px; height: 15px; }
.cmdbtn kbd { margin-left: 18px; }

/* ---- thanh công cụ ---- */
.tool { border-radius: 8px; }
.tool.on { box-shadow: 0 0 0 1px var(--ac-line), 0 4px 16px rgba(59, 195, 239, .28); }
.grp.tools { gap: 2px; }
.grp.tools .tsep { margin: 0 5px; }
.zbtn { min-width: 84px; justify-content: space-between; padding: 0 9px 0 12px; }
.zbtn #zoomLbl { min-width: 0; color: var(--tx); font-size: 13.5px; }
.zbtn .ic { width: 13px; height: 13px; color: var(--mu); }
.btn.primary { position: relative; }
.btn.primary.dirty::after { content: ""; position: absolute; top: -4px; right: -4px; width: 10px; height: 10px; border-radius: 50%; background: #ffb020; border: 2px solid var(--chrome); }
#app.empty .grp.tools, #app.empty #zoomBtn, #app.empty #bZoomIn, #app.empty #bZoomOut, #app.empty #bFit { opacity: .35; pointer-events: none; }

/* ---- menu thả xuống ---- */
.dd { animation: ddin .12s ease-out; border-radius: 12px; }
.dd button.danger { color: #ffb4b6; }
@keyframes ddin { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---- khung Trang: ô tìm và thanh nút ---- */
.findbox { gap: 8px; padding: 10px 10px 8px; }
.finder { display: flex; align-items: center; gap: 2px; height: 36px; padding: 0 4px 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #080e19; transition: border-color .12s, box-shadow .12s; }
.finder:focus-within { border-color: var(--ac-line); box-shadow: 0 0 0 3px var(--ac-soft); }
.finder > .ic-search { width: 15px; height: 15px; color: var(--mu2); flex: none; margin-right: 6px; }
.finder input { flex: 1; min-width: 0; height: 32px; padding: 0; border: 0; background: none; box-shadow: none; }
.finder #findCount { flex: none; color: var(--mu); font-size: 12px; padding: 0 4px; font-variant-numeric: tabular-nums; }
.fbtn { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--mu); cursor: pointer; flex: none; }
.fbtn:hover { background: var(--chrome-3); color: var(--tx); }
.fbtn .ic { width: 13px; height: 13px; }
.fopts { display: flex; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--chrome-2); color: var(--mu); cursor: pointer; font-size: 12.5px; transition: background .12s, color .12s, border-color .12s; }
.chip:hover { background: var(--chrome-3); color: var(--tx); }
.chip.tgl { height: 24px; padding: 0 10px; font-size: 12px; }
.chip.tgl[aria-pressed="true"] { background: var(--ac-soft); border-color: var(--ac-line); color: var(--ac-ink); }
.pacts { gap: 2px; padding: 6px 8px; align-items: center; flex-wrap: wrap; }
.pacts .tsep { height: 16px; margin: 0 3px; }
.pa { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 7px; background: none; color: var(--mu); cursor: pointer; transition: background .12s, color .12s; }
.pa:hover { background: var(--chrome-3); color: var(--tx); }
.pa.danger:hover { background: rgba(229, 86, 91, .18); color: #ffb4b6; }
.pa .ic { width: 17px; height: 17px; }
.th .n { display: inline-block; padding: 1px 9px; border-radius: 10px; margin-top: 6px; }
.th.cur .n { background: var(--ac-soft); color: var(--ac-ink); font-weight: 700; }
.th canvas { transition: box-shadow .12s; }

/* ---- khung Thuộc tính ---- */
#pTitle { color: var(--tx); font-weight: 700; font-size: 13.5px; margin-bottom: 14px; }
.props { gap: 16px; }
.props .pc, .props .pw, .props .psh { display: flex; flex-direction: column; gap: 8px; }
.props .ps { flex-direction: row; }
.plab { color: var(--mu); font-size: 12.5px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 0; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); position: relative; flex: none; transition: transform .1s; }
.sw:hover { transform: scale(1.12); }
.sw.on { box-shadow: 0 0 0 2px var(--pnl), 0 0 0 4px var(--ac); }
.sw-custom { background: conic-gradient(#f33, #fc3, #3d6, #3cf, #63f, #f3c, #f33); overflow: hidden; display: block !important; }
.sw-custom.on { background: var(--c); }
.props .sw-custom input[type=color] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #080e19; }
.seg button { flex: 1; height: 32px; display: flex; align-items: center; justify-content: center; padding: 0 6px; background: none; border: 0; color: var(--mu); cursor: pointer; font-size: 12.5px; transition: background .12s, color .12s; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--tx); background: var(--chrome-2); }
.seg button.on { background: var(--ac-soft); color: var(--ac-ink); }
.seg button i { display: block; width: 24px; background: currentColor; border-radius: 2px; }

/* ---- thanh nổi trên đối tượng ---- */
.obar { position: absolute; z-index: 6; display: flex; gap: 2px; padding: 4px; background: var(--pnl-h); border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 12px 30px rgba(0, 0, 0, .5); animation: ddin .12s ease-out; }
.ob { width: 34px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 7px; background: none; color: var(--tx); cursor: pointer; }
.ob:hover { background: var(--chrome-3); }
.ob.danger:hover { background: rgba(229, 86, 91, .2); color: #ffb4b6; }
.ob .ic { width: 16px; height: 16px; }
.ov .hdl { rx: 2px; }

/* ---- màn hình trống ---- */
.drop-in { max-width: 560px; padding: 44px 56px 36px; border: 1.5px dashed rgba(130, 165, 215, .26); border-radius: 24px; background: radial-gradient(120% 90% at 50% 0%, rgba(59, 195, 239, .07), transparent 60%); transition: border-color .15s, background .15s, transform .15s; }
.drop-in h1 { margin: 0 0 22px; }
#app.dragging .drop-in { border-color: var(--ac); background: var(--ac-soft); }
.caps { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 28px auto 0; max-width: 440px; }
.caps span { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--mu); font-size: 12.5px; background: rgba(255, 255, 255, .02); }
.drop-in .priv { margin-top: 22px; }

/* ---- thông báo, chờ ---- */
.toast { display: flex; align-items: flex-start; gap: 10px; border-left-width: 1px; padding: 12px 18px 12px 14px; animation: toastin .18s ease-out; }
.toast::before { content: ""; flex: none; width: 18px; height: 18px; margin-top: 1px; background: var(--ok); -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E"); }
.toast.bad::before { background: var(--bad); --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4 2.5 20h19z'/%3E%3Cpath d='M12 10v5M12 18v.01'/%3E%3C/svg%3E"); }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.busy { gap: 14px; }
.busy::before { content: ""; width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--ac); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- hộp thoại tối ---- */
.modal { background: var(--pnl); color: var(--tx); border: 1px solid var(--line); border-radius: 16px; animation: ddin .14s ease-out; }
.modal h2 { border-bottom: 1px solid var(--line); font-size: 15.5px; }
.modal .mb:empty { display: none; }
.modal .mf { border-top: 1px solid var(--line); background: var(--pnl-h); }
.modal .mf .btn { background: var(--chrome-2); border-color: var(--line); color: var(--tx); }
.modal .mf .btn:hover:not(:disabled) { background: var(--chrome-3); }
.modal .mf .btn.primary { background: var(--ac); border-color: var(--ac); color: var(--ac-on); }
.modal .mf .btn.primary:hover:not(:disabled) { background: var(--ac-ink); }
.modal .mf .btn.danger { background: transparent; border-color: rgba(229, 86, 91, .4); color: #ffb4b6; }
.modal .mf .btn.danger:hover:not(:disabled) { background: rgba(229, 86, 91, .14); }
.modal input[type=text], .modal input[type=password], .modal input[type=number], .modal select, .stmp .stmp-grid input, .stmp .wm-row input { background: #080e19; color: var(--tx); border: 1px solid var(--line); outline: none; }
.modal input:focus, .modal select:focus { border-color: var(--ac-line); box-shadow: 0 0 0 3px var(--ac-soft); }
.modal input::placeholder { color: var(--mu2); }
.modal input[type=color] { background: #080e19; border: 1px solid var(--line); border-radius: 6px; }
.modal code { background: rgba(255, 255, 255, .07); color: var(--ac-ink); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }
.stmp .rd, .stmp .stmp-opt label, .stmp .wm-row { color: var(--tx); }
.stmp .stmp-grid > span { color: var(--mu); }
.modal input[type=checkbox], .modal input[type=radio], .modal input[type=range] { accent-color: var(--ac); }
.sigpad { border-color: var(--line); }
.meta { color: var(--mu); font-size: 12.5px; margin-bottom: 14px; }
.warn { margin-bottom: 14px; padding: 9px 12px; border-radius: 9px; font-size: 13px; color: #e7c48b; background: rgba(201, 162, 63, .1); border: 1px solid rgba(201, 162, 63, .26); }
.fld { display: flex; flex-direction: column; gap: 7px; color: var(--mu); font-size: 12.5px; }
.fld input { width: 100%; height: 40px; border-radius: 9px; padding: 0 12px; font-size: 14px; }
.fld-ck { display: flex; align-items: center; gap: 10px; color: var(--tx); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---- bảng lệnh ---- */
.pal-bg { position: fixed; inset: 0; z-index: 55; display: flex; justify-content: center; align-items: flex-start; padding: 13vh 14px 0; background: rgba(4, 7, 12, .55); backdrop-filter: blur(3px); }
.pal { width: min(620px, 100%); background: var(--pnl); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .7); overflow: hidden; animation: ddin .14s ease-out; }
.pal-in { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 54px; border-bottom: 1px solid var(--line); }
.pal-in .ic { color: var(--mu); }
.pal-in input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--tx); font-size: 16px; }
.pal-in input::placeholder { color: var(--mu2); }
.pal-list { max-height: min(52vh, 420px); overflow: auto; padding: 6px; }
.pal-i { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 9px; background: none; color: var(--tx); text-align: left; cursor: pointer; font-size: 14.5px; }
.pal-i.on { background: var(--chrome-3); }
.pal-i.dis { opacity: .4; cursor: default; }
.pc-cat { flex: none; width: 92px; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--ac-ink); }
.pc-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- khung hẹp ---- */
@media (min-width: 821px) and (max-width: 1320px) { .grp.files .btn span { display: none; } .grp.files .btn { padding: 0 11px; gap: 0; } .cmdbtn span { display: none; } }
@media (max-width: 820px) {
	.cmdbtn { margin-right: 6px; padding: 0 9px; } .cmdbtn span, .cmdbtn kbd { display: none; }
	.tsep { margin: 0 3px; }
	.drop-in { padding: 30px 22px 26px; border-radius: 20px; }
	.pal-bg { padding-top: 8vh; }
}

/* ---- chọn trang, điều hướng ---- */
#app.empty .docnav { visibility: hidden; }
.th .ck { appearance: none; -webkit-appearance: none; width: 19px; height: 19px; top: 10px; left: 10px; margin: 0; border: 1.5px solid rgba(255, 255, 255, .75); border-radius: 6px; background: rgba(5, 8, 14, .62); opacity: 0; transition: opacity .12s, background .12s; z-index: 2; }
.th:hover .ck, .th .ck:checked, .th .ck:focus-visible { opacity: 1; }
.th .ck:checked { background: var(--ac) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2304222d' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7'/%3E%3C/svg%3E") center / 15px no-repeat; border-color: var(--ac); }
@media (hover: none) { .th .ck { opacity: 1; } }

/* ---- thanh công cụ gọn theo bề rộng ---- */
@media (min-width: 821px) and (max-width: 1500px) {
	.bar { gap: 6px; }
	.grp.tools { overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
	.grp.tools::-webkit-scrollbar { display: none; }
	.grp.tools .tool { padding: 0 8px; flex: none; }
	.grp.tools .tsep { margin: 0 2px; }
	.zbtn { min-width: 74px; padding: 0 7px 0 9px; }
	.grp.right { gap: 4px; }
}
@media (max-width: 820px) {
	.grp.tools { flex: 1 1 100%; }
	.grp.tools .tool { flex: none; }
}
@media (max-width: 820px) { .zbtn #zoomLbl { display: inline; } .zbtn { min-width: 70px; } }

/* Không để cuộn lan ra trang bao ngoài */
html, body { overscroll-behavior: none; }
.pages, .thumbs, .pbody, .pal-list, .dd, .modal { overscroll-behavior: contain; }

/* ---- chế độ đọc toàn màn hình ---- */
.ic-full { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3H5a2 2 0 0 0-2 2v3'/%3E%3Cpath d='M21 8V5a2 2 0 0 0-2-2h-3'/%3E%3Cpath d='M3 16v3a2 2 0 0 0 2 2h3'/%3E%3Cpath d='M16 21h3a2 2 0 0 0 2-2v-3'/%3E%3C/svg%3E"); }
.ic-exitfull { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3v3a2 2 0 0 1-2 2H3'/%3E%3Cpath d='M21 8h-3a2 2 0 0 1-2-2V3'/%3E%3Cpath d='M3 16h3a2 2 0 0 1 2 2v3'/%3E%3Cpath d='M16 21v-3a2 2 0 0 1 2-2h3'/%3E%3C/svg%3E"); }
.ic-minus { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E"); }
#app.empty #bRead { opacity: .35; pointer-events: none; }
#bRead[aria-pressed="true"] { border-color: var(--ac-line); color: var(--ac-ink); }
.rbar { display: none; }
#app.reading .rbar { display: flex; align-items: center; gap: 2px; position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 20; padding: 5px 8px; background: rgba(14, 23, 38, .92); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 40px rgba(0, 0, 0, .55); transition: opacity .25s, transform .25s; }
#app.reading .rbar.idle { opacity: 0; pointer-events: none; transform: translate(-50%, 10px); }
.rb { width: 36px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 9px; background: none; color: var(--tx); cursor: pointer; }
.rb:hover { background: var(--chrome-3); }
.rb .ic { width: 17px; height: 17px; }
.rbl { min-width: 54px; text-align: center; color: var(--mu); font-variant-numeric: tabular-nums; font-size: 13px; }
.rbar .tsep { margin: 0 5px; }
#app.reading .menubar, #app.reading .bar, #app.reading #docp > .ph, #app.reading .sidebtn, #app.reading .obar { display: none !important; }
#app.reading .pnl { border: 0; }
#app.reading .ov { pointer-events: none; }
#app.reading .pages { padding-top: 20px; }

/* ---- thẻ tệp ---- */
.dtabs { display: flex; align-items: stretch; flex: 0 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.dtabs::-webkit-scrollbar { display: none; }
.dtab { display: flex; align-items: center; gap: 6px; flex: none; max-width: 240px; padding: 0 6px 0 14px; border-top: 2px solid transparent; border-right: 1px solid var(--line); background: none; color: var(--mu); cursor: pointer; font-size: 14px; transition: background .12s, color .12s; }
.dtab:hover { background: var(--chrome-2); color: var(--tx); }
.dtab.on { background: var(--pnl); border-top-color: var(--ac); color: var(--tx); }
.dtab .dn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dtab.dirty .dn::after { content: "●"; color: #ffb020; font-size: 10px; margin-left: 8px; }
.dx { flex: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 6px; background: none; color: inherit; opacity: .55; cursor: pointer; }
.dtab:hover .dx, .dtab.on .dx { opacity: .9; }
.dx:hover { background: rgba(229, 86, 91, .22); color: #ffb4b6; opacity: 1; }
.dx .ic { width: 12px; height: 12px; }
.modal .warn b { color: var(--tx); }
