@font-face { font-family: "JBM"; src: url("vendor/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "JBM"; src: url("vendor/fonts/jetbrains-mono-latin-ext-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "JBM"; src: url("vendor/fonts/jetbrains-mono-vietnamese-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: "BVP"; src: url("vendor/fonts/BeVietnamPro-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "BVP"; src: url("vendor/fonts/BeVietnamPro-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
	/* Bản 3.x: nền không gian tối, kính mờ, màu nhấn theo công cụ (biến --ac, --ac2, --ac-on, --ac-rgb đặt ở cuối app.css theo data-mode). */
	--bg0: #05080f; --pnl: #0d1524; --pnl-h: #121c30;
	--glass: rgba(10, 16, 28, .74); --glass-2: rgba(16, 24, 40, .88);
	--line: rgba(150, 180, 230, .14); --line-2: rgba(150, 180, 230, .26);
	--tx: #eaf1fb; --mu: #9aa9c0; --mu2: #6b7b93;
	--ac: #4da3ff; --ac2: #8b7bff; --ac-on: #061426; --ac-rgb: 77, 163, 255;
	--ac-ink: color-mix(in srgb, var(--ac) 62%, #fff); --ac-soft: rgba(var(--ac-rgb), .13); --ac-line: rgba(var(--ac-rgb), .5);
	--bad: #ef6a70; --ok: #4fd1a0; --warn: #ffb84d;
	--r: 12px; --r-sm: 9px; --mbar: 58px;
	--ease: cubic-bezier(.2, .7, .2, 1);
}
* { 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; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(var(--ac-rgb), .35); }
#app { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; isolation: isolate;
	background:
		radial-gradient(1000px 520px at 50% -10%, rgba(var(--ac-rgb), .17), transparent 70%),
		radial-gradient(760px 460px at 100% 105%, rgba(var(--ac-rgb), .08), transparent 70%),
		radial-gradient(1.1px 1.1px at 14% 26%, rgba(255, 255, 255, .6), transparent) 0 0 / 290px 230px,
		radial-gradient(1px 1px at 63% 71%, rgba(255, 255, 255, .45), transparent) 0 0 / 370px 310px,
		radial-gradient(1.4px 1.4px at 86% 18%, rgba(255, 255, 255, .5), transparent) 0 0 / 510px 420px,
		var(--bg0); }

/* ---- thanh trên (kính mờ) ---- */
.menubar { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); min-height: var(--mbar); background: var(--glass); backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%); z-index: 7; flex: none; }
.menubar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(var(--ac-rgb), .55) 30%, rgba(var(--ac-rgb), .55) 70%, transparent); opacity: .55; }
.mb-l, .mb-r, .mb-c { display: flex; align-items: center; min-width: 0; }
.mb-l { gap: 2px; }
.mb-r { gap: 8px; justify-content: flex-end; }
.mb-c { gap: 10px; justify-content: center; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 14px 0 0; margin-right: 6px; border-right: 1px solid var(--line); height: 34px; }
.brand .mark { display: flex; filter: drop-shadow(0 4px 12px rgba(var(--ac-rgb), .45)); }
.brand svg { display: block; }
.wm { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.wm b { font-size: 10.5px; letter-spacing: .22em; color: var(--mu); font-weight: 700; }
.wm em { font-style: normal; font-size: 14px; font-weight: 700; color: var(--tx); white-space: nowrap; margin-top: 2px; }
.mbi { height: 34px; padding: 0 13px; border: 0; background: none; color: var(--mu); border-radius: var(--r-sm); cursor: pointer; font-size: 14px; white-space: nowrap; transition: background .15s, color .15s; }
.mbi:hover, .mbi[aria-expanded="true"] { background: rgba(255, 255, 255, .07); color: var(--tx); }
.fname { position: relative; max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 15px; border-radius: 999px; background: rgba(255, 255, 255, .045); border: 1px solid var(--line); color: var(--tx); font-size: 13px; }
.fname:empty { display: none; }
.fname.dirty::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 10px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 10px var(--warn); vertical-align: 1px; }
.autosave { color: var(--mu2); font-size: 12px; white-space: nowrap; }

/* ---- nút ---- */
.btn, .tool { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid transparent; background: transparent; color: var(--tx); border-radius: 10px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .12s var(--ease), box-shadow .2s; }
.btn { border-color: var(--line); background: rgba(255, 255, 255, .05); }
.btn:hover:not(:disabled), .tool:hover { background: rgba(255, 255, 255, .1); border-color: var(--line-2); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.985); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--ac), var(--ac2)); border-color: transparent; color: var(--ac-on); font-weight: 700; box-shadow: 0 8px 22px -8px rgba(var(--ac-rgb), .7), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08) saturate(1.05); box-shadow: 0 12px 28px -8px rgba(var(--ac-rgb), .85), inset 0 1px 0 rgba(255, 255, 255, .4); }
.btn.danger { color: #ffb4b6; border-color: rgba(239, 106, 112, .4); background: transparent; }
.btn.danger:hover:not(:disabled) { background: rgba(239, 106, 112, .14); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.lg { height: 52px; padding: 0 28px; font-size: 15.5px; border-radius: 14px; }
.tool { color: var(--mu); }
.tool:hover { color: var(--tx); }
#bRead[aria-pressed="true"] { border-color: var(--ac-line); color: var(--ac-ink); background: var(--ac-soft); }
#app.empty #bRead, #app.empty #bSave, #app.empty #bMore { opacity: .4; pointer-events: none; }
#app.empty .menubar .btn.primary { background: rgba(255, 255, 255, .08); color: var(--mu); box-shadow: none; }
.split { position: relative; display: inline-flex; }
.split #bSave { border-top-right-radius: 0; border-bottom-right-radius: 0; padding-right: 15px; }
.split .save-more { padding: 0 9px; border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 1px solid rgba(0, 0, 0, .22); }

.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-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-print { --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='M6 9V3h12v6M6 18H4a1 1 0 0 1-1-1v-6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1h-2'/%3E%3Crect x='6' y='14' width='12' height='7'/%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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E"); }
.ic-caret { --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 10 5 5 5-5'/%3E%3C/svg%3E"); }
.ic-key { --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='2.5' y='6' width='19' height='12' rx='2'/%3E%3Cpath d='M6 10h.01M10 10h.01M14 10h.01M18 10h.01M7 14h10'/%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='m6 15 6-6 6 6'/%3E%3C/svg%3E"); }
.ic-down { --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='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.ic-copy { --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='8' y='8' width='12' height='12' rx='2'/%3E%3Cpath d='M4 16V6a2 2 0 0 1 2-2h10'/%3E%3C/svg%3E"); }
.ic-eye { --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='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E"); }
.ic-eye-off { --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 3l18 18M10.6 5.1A10 10 0 0 1 12 5c6.4 0 10 7 10 7a17 17 0 0 1-3.2 4M6.6 6.6C3.9 8.3 2 12 2 12s3.6 7 10 7a9.6 9.6 0 0 0 5.4-1.6M9.9 9.9a3 3 0 0 0 4.2 4.2'/%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 7h16M9 7V4h6v3M6 7l1 13h10l1-13'/%3E%3C/svg%3E"); }
.ic-grip { --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 6h.01M15 6h.01M9 12h.01M15 12h.01M9 18h.01M15 18h.01' stroke-width='3'/%3E%3C/svg%3E"); }
.ic-play-from { --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 4.5v15'/%3E%3Cpath d='M9 4.5v15l11-7.5z' fill='black'/%3E%3C/svg%3E"); }
.ic-play { --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 4.5v15l12-7.5z' fill='black'/%3E%3C/svg%3E"); }
.ic-presenter { --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='2.5' y='4' width='12' height='9' rx='1.5'/%3E%3Cpath d='M17.5 6h4M17.5 10h4M2.5 17h19M8 13v4'/%3E%3C/svg%3E"); }
.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-read { --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='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 5.5c3-1.5 6-1.5 9 1 3-2.5 6-2.5 9-1V19c-3-1.5-6-1.5-9 1-3-2.5-6-2.5-9-1z'/%3E%3Cpath d='M12 6.5V20'/%3E%3C/svg%3E"); }
.ic-tree { --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='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='7' height='5' rx='1.2'/%3E%3Crect x='14' y='10' width='7' height='5' rx='1.2'/%3E%3Crect x='14' y='17' width='7' height='4' rx='1.2'/%3E%3Cpath d='M6.5 9v10.5H14M6.5 12.5H14'/%3E%3C/svg%3E"); }
.ic-format { --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='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6h16M8 10h12M8 14h12M4 18h16'/%3E%3C/svg%3E"); }
.ic-minify { --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='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h16M8 8l-4 4 4 4M16 8l4 4-4 4'/%3E%3C/svg%3E"); }
.ic-fold { --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='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 9l5-5 5 5M7 15l5 5 5-5'/%3E%3C/svg%3E"); }
.ic-unfold { --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='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 4l5 5 5-5M7 20l5-5 5 5'/%3E%3C/svg%3E"); }
.ic-wrap { --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='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6h16M4 12h13a3 3 0 0 1 0 6h-4M4 18h5M15 16l-2 2 2 2'/%3E%3C/svg%3E"); }
.ic-find { --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='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6'/%3E%3Cpath d='m15 15 5 5'/%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='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.5 9 17.5 20 6.5'/%3E%3C/svg%3E"); }
.ic-schema { --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='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h9l4 4v14H6z'/%3E%3Cpath d='M14 3v5h5M9 12h7M9 16h7'/%3E%3C/svg%3E"); }
.ic-xpath { --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='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 19 19 5'/%3E%3Ccircle cx='6' cy='6' r='2.5'/%3E%3Ccircle cx='18' cy='18' r='2.5'/%3E%3C/svg%3E"); }
.ic-xslt { --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='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h9M10 4l3 3-3 3M20 17h-9M14 14l-3 3 3 3'/%3E%3Crect x='15' y='4' width='5' height='6' rx='1'/%3E%3Crect x='4' y='14' width='5' height='6' rx='1'/%3E%3C/svg%3E"); }


/* ---- vùng làm việc: khung LibreOffice như một cửa sổ nổi ---- */
.stage { flex: 1; min-height: 0; position: relative; z-index: 0; isolation: isolate; color: var(--tx); }

/* ---- màn hình đầu ---- */
.drop { position: absolute; inset: var(--mbar) 0 0 0; display: flex; align-items: center; justify-content: center; overflow: auto; overscroll-behavior: contain; padding: 24px max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); z-index: 3; }
#app:not(.empty) .drop { display: none; }
.drop-in { max-width: 640px; width: 100%; margin: auto; padding: 8px 24px 28px; text-align: center; animation: rise .7s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.hero-art { position: relative; display: inline-block; width: 168px; height: 168px; margin-bottom: 10px; perspective: 700px; }
.hero-art svg { position: absolute; left: 50%; top: 50%; width: 118px; height: 118px; margin: -59px 0 0 -59px; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .5)); animation: float 6s ease-in-out infinite; }
.hero-art::before { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 1px solid rgba(var(--ac-rgb), .4); background: radial-gradient(circle at 50% 0, #fff 0 2.5px, rgba(var(--ac-rgb), .9) 3px, transparent 7px); box-shadow: 0 0 40px -6px rgba(var(--ac-rgb), .35), inset 0 0 40px -14px rgba(var(--ac-rgb), .3); animation: orbit 16s linear infinite; }
.hero-art::after { content: ""; position: absolute; inset: 22px -34px; border-radius: 50%; border: 1px solid var(--line); transform: rotate(-14deg); }
@keyframes orbit { from { transform: rotateX(72deg) rotateZ(0); } to { transform: rotateX(72deg) rotateZ(360deg); } }
@keyframes float { 0%, 100% { transform: translateY(-3px); } 50% { transform: translateY(4px); } }
.drop-in h1 { margin: 6px 0 26px; font-size: 42px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; background: linear-gradient(180deg, #fff 30%, color-mix(in srgb, var(--ac) 45%, #b7c4da)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.btnrow { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin: 4px 0 2px; }
.drop::after { content: ""; position: absolute; inset: 18px; border: 2px dashed var(--ac); border-radius: 28px; background: var(--ac-soft); opacity: 0; pointer-events: none; transition: opacity .18s; }
#app.dragging .drop::after { opacity: 1; }
.restore { margin: 30px auto 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; background: var(--ac-soft); border: 1px solid var(--ac-line); border-radius: 14px; padding: 12px 14px; backdrop-filter: blur(8px); }
.restore p { margin: 0; flex-basis: 100%; color: var(--ac-ink); font-size: 13.5px; }

/* ---- menu thả xuống, hộp thoại, thông báo (kính mờ) ---- */
.dd, .modal, .toast, .help, .ime, #app.reading .rbar { background: var(--glass-2); backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%); border: 1px solid var(--line-2); }
.dd { position: fixed; z-index: 80; color: var(--tx); border-radius: 14px; box-shadow: 0 22px 56px rgba(0, 0, 0, .6); padding: 6px; min-width: 260px; max-height: calc(100vh - 60px); overflow: auto; animation: ddin .14s var(--ease); overscroll-behavior: contain; }
.dd button { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: none; border: 0; border-radius: 9px; padding: 9px 12px; color: inherit; cursor: pointer; white-space: nowrap; }
.dd button:hover:not(:disabled), .dd button:focus-visible { background: rgba(var(--ac-rgb), .16); outline: none; }
.dd button:disabled { opacity: .38; cursor: default; }
.dd .kb { margin-left: auto; padding-left: 24px; color: var(--mu2); font-size: 12px; }
.dd .mdiv { height: 1px; background: var(--line); margin: 6px 4px; }
@keyframes ddin { from { opacity: 0; transform: translateY(-5px) scale(.985); } to { opacity: 1; transform: none; } }
.mov { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(3, 5, 10, .66); backdrop-filter: blur(4px); }
.modal { color: var(--tx); border-radius: 20px; max-width: 460px; width: 100%; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); overflow: hidden; animation: ddin .18s var(--ease); }
.modal h2 { margin: 0; padding: 18px 22px 4px; font-size: 17px; letter-spacing: -.01em; }
.modal .mb { padding: 8px 22px 18px; line-height: 1.55; color: var(--mu); }
.modal .mf { padding: 14px 22px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); background: rgba(255, 255, 255, .025); flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; align-items: flex-start; gap: 11px; color: var(--tx); padding: 13px 20px 13px 16px; border-radius: 14px; box-shadow: 0 18px 48px rgba(0, 0, 0, .6); z-index: 95; max-width: min(560px, 92vw); font-size: 13.5px; animation: ddin .22s var(--ease); }
.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"); }

/* ---- màn chờ tải ---- */
.busy { position: fixed; inset: 0; z-index: 85; display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center; color: var(--mu); font-weight: 400; font-size: 14px; background: radial-gradient(700px 420px at 50% 42%, rgba(var(--ac-rgb), .16), transparent 70%), #04070d; animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.busy::before { content: ""; width: 58px; height: 58px; border-radius: 50%; order: 0; background: conic-gradient(from 0deg, transparent 0 40%, var(--ac) 85%, var(--ac2)); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px)); animation: spin 1.05s linear infinite; filter: drop-shadow(0 0 14px rgba(var(--ac-rgb), .55)); }
#busyText { order: 2; letter-spacing: .02em; }
.busy-sub { order: 1; }
.busy .bar { order: 3; }
@keyframes spin { to { transform: rotate(360deg); } }
kbd { font: inherit; font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .05); color: var(--mu); white-space: nowrap; }

/* ---- hướng dẫn nhanh ---- */
.help { width: min(660px, 94vw); max-height: 86vh; padding: 0; border-radius: 20px; color: var(--tx); box-shadow: 0 34px 90px rgba(0, 0, 0, .65); }
.help::backdrop { background: rgba(3, 5, 10, .66); backdrop-filter: blur(4px); }
.help-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 22px; border-bottom: 1px solid var(--line); font-size: 15px; }
.help-b2 { padding: 6px 22px 20px; overflow: auto; max-height: calc(86vh - 60px); }
.help h2 { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ac-ink); margin: 18px 0 6px; }
.help dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13.5px; }
.help dt { color: var(--mu); }
.help dd { margin: 0; }
.help p { color: var(--mu); font-size: 12.5px; margin: 8px 0 0; }

/* ---- toàn màn hình ---- */
.rbar { display: none; }
#app.reading .rbar { display: flex; align-items: center; gap: 2px; position: fixed; right: 18px; top: 16px; z-index: 60; padding: 5px; 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: translateY(-8px); }
.rb { width: 38px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--tx); cursor: pointer; }
.rb:hover { background: rgba(255, 255, 255, .12); }
.rb .ic { width: 17px; height: 17px; }
#app.reading .menubar { display: none !important; }

/* ---- màn hình hẹp ---- */
@media (max-width: 1100px) { .btn .lbl-d, #bIme span, #bRead span { display: none; } #bIme, #bRead { padding: 0 11px; } .autosave { display: none; } }
@media (max-width: 860px) { .wm, .fname { display: none; } .menubar { grid-template-columns: auto 1fr auto; } }
@media (max-width: 640px) {
	.menubar { gap: 4px; padding-left: 8px; padding-right: 8px; }
	.mbi { padding: 0 9px; }
	.brand { padding-right: 8px; margin-right: 2px; }
	.btn span { display: none; }
	.btn.lg span { display: inline; }
	.btn.lg { padding: 0 22px; }
	.drop-in h1 { font-size: 32px; }
	.hero-art { width: 132px; height: 132px; } .hero-art svg { width: 92px; height: 92px; margin: -46px 0 0 -46px; }
}
@media (max-width: 420px) { .brand { display: none; } .drop-in h1 { font-size: 27px; margin-bottom: 18px; } .help dl { grid-template-columns: 1fr; gap: 2px 0; } .help dd { margin-bottom: 6px; } }
@media (max-height: 560px) { :root { --mbar: 48px; } .hero-art { display: none; } .drop-in h1 { font-size: 26px; margin-bottom: 14px; } }
@media (pointer: coarse) { .dd button { height: 46px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- in ---- */
#printArea { display: none; }
@media print {
	html, body, #app { height: auto; background: #fff; overflow: visible; }
	.menubar, .tabrow, .toast, .busy, .drop, .rbar, .help, .dd, .mov { display: none !important; }
	.host.off { display: none !important; }
	body.print-area #app, body.print-area .toast { display: none !important; }
	body.print-area #printArea { display: block; color: #000; background: #fff; font: 10pt/1.3 "BVP", system-ui, sans-serif; }
	.pr-sheet h1 { font-size: 12pt; margin: 0 0 6pt; }
	.pr-sheet table { border-collapse: collapse; }
	.pr-sheet td { border: .5pt solid #999; padding: 2pt 4pt; vertical-align: top; white-space: pre-wrap; }
}

/* ---- Soạn thảo XML ---- */
#app:not(.empty) .drop { display: none; }
#app.empty .stage .work { visibility: hidden; }
#app.empty #bRead, #app.empty #bSave, #app.empty #bMore { opacity: .4; pointer-events: none; }
.work { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto; gap: 8px; padding: 8px 10px 10px; }
.xbar { display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); overflow-x: auto; scrollbar-width: none; }
.xbar::-webkit-scrollbar { display: none; }
.xb { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px; border: 0; border-radius: 10px; background: none; color: var(--mu); cursor: pointer; white-space: nowrap; font-size: 13px; transition: background .15s, color .15s; }
.xb:hover { background: rgba(var(--ac-rgb), .14); color: var(--tx); }
.xb[aria-pressed="true"] { color: var(--ac-ink); background: var(--ac-soft); }
.xb .ic { width: 17px; height: 17px; }
.xsep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 4px 0 10px; border-radius: 999px; background: var(--ac-soft); border: 1px solid var(--ac-line); color: var(--ac-ink); font-size: 12.5px; white-space: nowrap; }
.chip button { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; }
.chip button:hover { background: rgba(255, 255, 255, .12); }
.chip .ic { width: 12px; height: 12px; }
.body { display: grid; grid-template-columns: 300px 1fr; gap: 10px; min-height: 0; }
#app.notree .body { grid-template-columns: 1fr; }
#app.notree .treepane { display: none; }
.treepane { display: flex; flex-direction: column; min-height: 0; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); overflow: hidden; }
.tree { list-style: none; margin: 0; padding: 6px 4px; overflow: auto; flex: 1; min-height: 0; font-size: 13px; overscroll-behavior: contain; }
.tree ul { list-style: none; margin: 0; padding: 0; display: none; }
.tree li.open > ul { display: block; }
.tree .row { display: flex; align-items: baseline; gap: 6px; padding: 3px 8px 3px 6px; border-radius: 8px; cursor: pointer; white-space: nowrap; overflow: hidden; outline: none; }
.tree .row:hover { background: rgba(255, 255, 255, .05); }
.tree .row.sel { background: var(--ac-soft); box-shadow: inset 0 0 0 1px var(--ac-line); }
.tree .tw { width: 12px; flex: none; color: var(--mu2); text-align: center; transition: transform .15s; display: inline-block; }
.tree li.open > .row .tw { transform: rotate(90deg); }
.tree .tn { color: #7cc7ff; font-weight: 700; }
.tree .ta { color: #ffcb6b; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.tree .tt { color: var(--mu); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.note { margin: 0; padding: 4px 12px; color: var(--mu2); font-size: 12px; }
.attrs { border-top: 1px solid var(--line); padding: 10px 10px 12px; max-height: 45%; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.attrs h3 { margin: 0 0 2px; font: 700 13px/1.4 "JBM", ui-monospace, monospace; color: #7cc7ff; }
.arow { display: grid; grid-template-columns: minmax(60px, 38%) 1fr 30px; gap: 6px; align-items: center; }
.arow label { color: #ffcb6b; font: 12.5px "JBM", ui-monospace, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow input { height: 30px; min-width: 0; padding: 0 9px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, .25); color: var(--tx); outline: none; font: 12.5px "JBM", ui-monospace, monospace; }
.arow input:focus, .qrow input:focus { border-color: var(--ac-line); box-shadow: 0 0 0 3px rgba(var(--ac-rgb), .18); }
.arow.add { grid-template-columns: minmax(60px, 38%) 1fr 30px; padding-top: 6px; border-top: 1px dashed var(--line); }
.ib { width: 30px; height: 28px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; background: none; color: var(--mu); cursor: pointer; }
.ib:hover { background: rgba(255, 255, 255, .09); color: var(--tx); }
.ib .ic { width: 16px; height: 16px; }
.edpane { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-radius: 16px; border: 1px solid var(--line-2); background: #070c15; overflow: hidden; box-shadow: 0 22px 60px -30px rgba(0, 0, 0, .8); }
.editor { flex: 1; min-height: 0; }
.editor .cm-editor { height: 100%; }
.editor .cm-editor.cm-focused { outline: none; }
.fold { color: var(--mu2); cursor: pointer; padding: 0 3px; }
.fold:hover { color: var(--ac-ink); }
.sbar { display: flex; gap: 16px; align-items: center; padding: 5px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--mu); white-space: nowrap; overflow: hidden; }
.sbc { margin-left: auto; font-weight: 700; }
.sbc.ok { color: var(--ok); }
.sbc.bad { color: var(--bad); }
.dock { display: none; min-height: 0; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
#app.dockopen .dock { display: flex; flex-direction: column; height: min(34vh, 320px); }
#app:not(.dockopen) .work .dtabs-float { display: none; }
.dtabs { display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.dtabs button[data-dock] { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--mu); cursor: pointer; font-weight: 700; font-size: 12.5px; }
.dtabs button[data-dock].on { background: var(--ac-soft); color: var(--ac-ink); }
#tabProb[data-n]:not([data-n=""]):not([data-n="0"])::after { content: attr(data-n); margin-left: 7px; padding: 1px 7px; border-radius: 999px; background: rgba(239, 106, 112, .2); color: #ffb4b6; font-size: 11px; }
.dclose { margin-left: auto; }
.dpane { flex: 1; min-height: 0; overflow: auto; padding: 8px 10px; }
.plist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.plist li { display: flex; gap: 10px; align-items: baseline; padding: 5px 8px; border-radius: 8px; cursor: pointer; outline: none; }
.plist li:hover, .plist li:focus-visible { background: rgba(255, 255, 255, .05); }
.plist .ln { flex: none; min-width: 64px; color: var(--mu2); font-size: 12px; }
.prob.e::before, .prob.w::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); align-self: center; }
.prob.w::before { background: var(--warn); }
.plist .nk { color: #7cc7ff; font: 12.5px "JBM", ui-monospace, monospace; flex: none; }
.plist .nv { color: var(--tx); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist li.val { font: 14px "JBM", ui-monospace, monospace; color: var(--ac-ink); cursor: default; }
.plist li.err { color: #ffb4b6; cursor: default; }
.empty-ok { margin: 6px 8px; color: var(--ok); font-size: 13px; }
.qrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.qrow input { flex: 1; min-width: 180px; height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, .28); color: var(--tx); outline: none; font: 13px "JBM", ui-monospace, monospace; }
.qrow .grow { flex: 1; }
.muted { color: var(--mu); font-size: 12.5px; }
.ns { margin: 0 0 6px; font: 11.5px "JBM", ui-monospace, monospace; word-break: break-all; }
.ns:empty { display: none; }
.xsout { margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); font: 12.5px/1.55 "JBM", ui-monospace, monospace; color: var(--tx); white-space: pre-wrap; word-break: break-word; min-height: 60px; }
.xsout:empty { display: none; }
#app.reading .work { padding: 0; gap: 0; }
#app.reading .xbar, #app.reading .treepane, #app.reading .dock { display: none !important; }
#app.reading .body { grid-template-columns: 1fr; }
#app.reading .edpane { border-radius: 0; border: 0; }
@media (max-width: 1100px) { .body { grid-template-columns: 250px 1fr; } .xb span { display: none; } .xb { padding: 0 9px; } }
@media (max-width: 760px) {
	.body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 38%) 1fr; }
	#app.notree .body { grid-template-rows: 1fr; }
	.work { padding: 6px; gap: 6px; }
}

/* ---- chế độ đọc ---- */
#app.viewmode .treepane, #app.viewmode .edonly { display: none !important; }
#app.viewmode .body { grid-template-columns: 1fr; }
#app.viewmode .editor { display: none; }
.reader { flex: 1; min-height: 0; overflow: auto; padding: 22px clamp(14px, 4vw, 48px) 40px; overscroll-behavior: contain; background: radial-gradient(800px 300px at 50% -60px, rgba(var(--ac-rgb), .08), transparent 70%); }
.rdoc { max-width: 1100px; margin: 0 auto; font-size: 14.5px; line-height: 1.55; }
.rmeta { color: var(--mu); font-size: 12.5px; margin-bottom: 14px; }
.rmeta b { color: #7cc7ff; font-family: "JBM", ui-monospace, monospace; font-weight: 400; }
.rname { color: #7cc7ff; font: 600 13px "JBM", ui-monospace, monospace; }
.rsec { margin: 6px 0; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .025); }
.rsec > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 14px; cursor: pointer; list-style: none; border-radius: 14px; }
.rsec > summary::-webkit-details-marker { display: none; }
.rsec > summary::before { content: "▸"; color: var(--mu2); transition: transform .15s; display: inline-block; width: 10px; }
.rsec[open] > summary::before { transform: rotate(90deg); }
.rsec > summary:hover { background: rgba(255, 255, 255, .04); }
.rsec.d0 { border-color: var(--ac-line); background: rgba(var(--ac-rgb), .04); }
.rsec.d0 > summary .rname { font-size: 15px; color: var(--ac-ink); }
.rbody { padding: 2px 14px 12px 32px; }
.rrow { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 4px 16px; align-items: baseline; padding: 5px 0; border-bottom: 1px dashed rgba(150, 180, 230, .1); }
.rrow .rchips { grid-column: 1 / -1; order: 3; }
.rval { color: var(--tx); white-space: pre-wrap; word-break: break-word; }
.rnil { color: var(--mu2); }
.rchips { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.rchip { display: inline-flex; border-radius: 7px; overflow: hidden; border: 1px solid rgba(255, 203, 107, .3); font-size: 12px; }
.rchip b { padding: 1px 7px; background: rgba(255, 203, 107, .14); color: #ffcb6b; font-weight: 600; font-family: "JBM", ui-monospace, monospace; }
.rchip span { padding: 1px 8px; color: var(--tx); }
.rtext { margin: 8px 0; color: var(--tx); white-space: pre-wrap; }
pre.rtext { padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, .3); font: 12.5px "JBM", ui-monospace, monospace; }
.rcomment { margin: 6px 0; color: var(--mu2); font-style: italic; font-size: 13px; }
.rcomment::before { content: "— "; }
.rtable { margin: 10px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, .18); }
.rth { display: flex; align-items: baseline; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.rcount { color: var(--mu); font-size: 12px; }
.rscroll { overflow: auto; max-height: 70vh; }
.rtable table { border-collapse: collapse; width: 100%; font-size: 13px; }
.rtable th, .rtable td { padding: 6px 10px; text-align: left; border-bottom: 1px solid rgba(150, 180, 230, .08); vertical-align: top; }
.rtable th { position: sticky; top: 0; background: #101a2b; color: #7cc7ff; font: 600 12px "JBM", ui-monospace, monospace; white-space: nowrap; z-index: 1; }
.rtable th.ra { color: #ffcb6b; }
.rtable td { color: var(--tx); word-break: break-word; }
.rtable tbody tr:hover td { background: rgba(var(--ac-rgb), .06); }
.rtable .rno { color: var(--mu2); width: 1%; white-space: nowrap; font-size: 12px; }
.rmore { margin: 8px 12px; }
.rmore[hidden] { display: none; }
.rbad { max-width: 520px; margin: 40px auto; text-align: center; color: var(--mu); }
@media (max-width: 640px) { .rrow { grid-template-columns: 1fr; } .rbody { padding-left: 14px; } }
#app.viewmode #sbPos { display: none; }

/* ---- hóa đơn điện tử ---- */
.sbsig { color: #ffcb6b; }
.sbsig[hidden] { display: none; }
.rseg { display: inline-flex; gap: 4px; padding: 3px; margin-bottom: 14px; border-radius: 11px; border: 1px solid var(--line); background: rgba(0, 0, 0, .2); }
.rseg .btn { border-color: transparent; background: transparent; }
.rseg .btn[aria-pressed="true"] { background: rgba(var(--ac-rgb), .16); color: var(--ac-ink); border-color: var(--ac-line); }
.inv { display: grid; gap: 12px; margin-bottom: 28px; }
.inv + .inv { padding-top: 24px; border-top: 1px dashed var(--line); }
.ivhead { padding: 18px 20px; border-radius: 16px; border: 1px solid var(--ac-line); background: linear-gradient(135deg, rgba(var(--ac-rgb), .12), rgba(255, 255, 255, .02)); }
.ivhead h2 { margin: 0 0 10px; font-size: 20px; letter-spacing: .02em; color: var(--tx); }
.ivmeta { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.ivmeta span { display: inline-flex; gap: 7px; align-items: baseline; }
.ivmeta i { font-style: normal; color: var(--mu); font-size: 12.5px; }
.ivmeta b { font: 600 14px "JBM", ui-monospace, monospace; color: var(--tx); word-break: break-all; }
.ivcard { padding: 12px 16px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .025); min-width: 0; }
.ivcard h3 { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mu); }
.ivparties { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.ivdl { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 5px 16px; margin: 0; }
.ivdl dt { color: var(--mu); font-size: 13px; }
.ivdl dt.ivx { color: #ffcb6b; }
.ivdl dd { margin: 0; color: var(--tx); word-break: break-word; }
.ivseller .ivdl dd:first-of-type, .ivbuyer .ivdl dd:first-of-type { font-weight: 600; }
.ivitems td { white-space: pre-wrap; }
.ivitems th.num, .ivitems td.num, .ivrate .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ivitems tr.tc2 td, .ivitems tr.tc3 td { color: #9fd8a8; }
.ivitems tr.tc4 td { color: var(--mu); font-style: italic; }
.ivtot { display: grid; gap: 12px; }
.ivrate { border-collapse: collapse; width: 100%; max-width: 560px; font-size: 13px; }
.ivrate th, .ivrate td { padding: 5px 10px; border-bottom: 1px solid rgba(150, 180, 230, .1); text-align: left; }
.ivrate th { color: var(--mu); font-weight: 600; font-size: 12px; }
.ivsum dd { font-variant-numeric: tabular-nums; }
.ivgrand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; padding: 12px 14px; border-radius: 12px; background: rgba(var(--ac-rgb), .1); border: 1px solid var(--ac-line); }
.ivgrand span { color: var(--mu); }
.ivgrand b { font-size: 20px; color: var(--ac-ink); font-variant-numeric: tabular-nums; }
.ivgrand em { flex-basis: 100%; color: var(--tx); }
.ivsig { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ivsig li { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.ivsig b { min-width: 110px; color: var(--mu); font-weight: 600; font-size: 13px; }
.ivwarn { margin: 10px 0 0; font-size: 12.5px; color: #ffcb6b; }
@media (max-width: 640px) { .ivdl { grid-template-columns: 1fr; gap: 0; } .ivdl dd { margin-bottom: 6px; } .ivhead h2 { font-size: 17px; } }

/* ---- chứng từ, thông báo, tờ khai của cơ quan thuế ---- */
.ivtype { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ac-ink); margin-bottom: 4px; }
.ivnote { margin: 0; font-size: 13px; color: var(--mu); }
.taxdoc .ivcard .ivcard { margin-top: 10px; background: rgba(255, 255, 255, .02); }
.taxdoc .ivcard .rtable { margin-top: 10px; }
.taxdoc .ivcard > div > .ivdl + .ivcard, .taxdoc .ivcard > div > .ivdl + .rtable { margin-top: 12px; }
.ivdl dt.ivct { font-family: "JBM", ui-monospace, monospace; color: #7cc7ff; }

/* ---- thanh chọn cách trình bày ---- */
.rbar2 { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 14px; }
.rbar2 .rseg { margin-bottom: 0; flex-wrap: wrap; }
.rtools { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.rtools [hidden] { display: none; }
.rnote { margin: 0 0 8px; font-size: 12.5px; color: var(--mu); }
.rofficial { display: block; width: 100%; min-height: 400px; border: 0; border-radius: 6px; background: #fff; box-shadow: 0 10px 40px rgba(0, 0, 0, .45); }

/* ---- trang in (bản thể hiện) ---- */
.ppages { display: grid; gap: 22px; justify-items: center; }
.paper { box-sizing: border-box; width: min(210mm, 100%); min-height: 120mm; padding: 14mm 14mm 16mm; background: #fff; color: #111; border-radius: 3px; box-shadow: 0 10px 40px rgba(0, 0, 0, .45);
	font: 13.5px/1.45 "Times New Roman", "Liberation Serif", "Noto Serif", "DejaVu Serif", serif; }
.paper * { color: inherit; }
.paper h1 { margin: 0; font-size: 19px; font-weight: 700; text-align: center; text-transform: uppercase; letter-spacing: .02em; }
.paper .pl { margin: 2px 0; }
.paper .pk { color: #333; }
.paper .pl.strong .pv { font-weight: 700; text-transform: uppercase; }
.phead3 { display: grid; grid-template-columns: 1fr 1.6fr 1fr; gap: 10px; align-items: start; padding-bottom: 8px; border-bottom: 1.5px solid #111; margin-bottom: 8px; }
.pseller .pname { font-size: 12px; text-transform: uppercase; }
.ptitle { text-align: center; }
.psub, .pmccqt { font-size: 12.5px; font-style: italic; }
.pdate { margin-top: 3px; font-style: italic; }
.pmccqt { font-style: normal; margin-top: 2px; }
.pserial { font-size: 12.5px; }
.prel { text-align: center; font-style: italic; margin: 4px 0 8px; }
.pparty { display: grid; gap: 6px; margin: 6px 0 10px; }
.pblock { padding: 6px 0; border-bottom: 1px dashed #999; }
.ptable { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 12.5px; }
.ptable th, .ptable td { border: 1px solid #333; padding: 4px 6px; vertical-align: top; white-space: pre-wrap; }
.ptable th { font-weight: 700; text-align: center; background: #f2f2f2; }
.ptable .pidx td { text-align: center; font-style: italic; font-size: 11px; padding: 1px 4px; }
.ptable td.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ptable td.c { text-align: center; }
.ptable tr.pnote td { font-style: italic; }
.psum { margin: 6px 0; }
.psum .prow { display: flex; justify-content: flex-end; gap: 14px; padding: 2px 6px; }
.psum .prow b { min-width: 130px; text-align: right; font-variant-numeric: tabular-nums; }
.psum .prow .pmid { margin-left: 30px; }
.psum .ptotal { border-top: 1px solid #333; margin-top: 4px; padding-top: 4px; font-weight: 700; }
.psum .prate { width: auto; margin-left: auto; }
.pwords { margin: 6px 0; }
.pother { margin-top: 8px; font-size: 12.5px; }
.psigns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; text-align: center; }
.psign b { display: block; text-transform: uppercase; }
.psign i { font-size: 12px; }
.pstamp { display: inline-grid; gap: 2px; margin-top: 10px; padding: 6px 10px; border: 1.5px solid #b22; color: #b22; font-size: 11.5px; text-align: left; }
.pstamp span:first-child { font-weight: 700; }
.pfoot { margin-top: 14px; font-size: 11.5px; font-style: italic; text-align: center; }
.phead2 { display: grid; grid-template-columns: 1fr 1.3fr; gap: 12px; text-align: center; margin-bottom: 10px; }
.pissuer b, .pnation b { display: block; font-size: 13px; }
.pmotto { text-decoration: underline; text-underline-offset: 3px; }
.pplace { display: block; margin-top: 8px; font-size: 13px; }
.pform { text-align: right; font-size: 12.5px; margin: -4px 0 8px; }
.psub2 { text-align: center; font-weight: 700; margin: 2px 0 12px; }
.pcontent { margin-top: 10px; }
/* nội dung chi tiết trong trang in: bỏ khung tối, giữ cấu trúc */
.paper .ivcard { background: none; border: 0; padding: 4px 0 6px; border-radius: 0; }
.paper .ivcard h3 { color: #111; font-size: 13px; letter-spacing: 0; margin: 6px 0 4px; }
.paper .ivcard .ivcard { margin-top: 4px; padding-left: 10px; border-left: 1px solid #ccc; }
.paper .ivdl { gap: 2px 14px; }
.paper .ivdl dt { color: #333; font-size: 13px; }
.paper .ivdl dt.ivx, .paper .ivdl dt.ivct { color: #333; }
.paper .ivdl dd { color: #111; }
.paper .ivwarn { color: #8a5a00; }
.paper .ivsig b { color: #333; }
.paper .rtable { background: none; border-color: #333; }
.paper .rtable th { background: #f2f2f2; color: #111; font-family: inherit; }
.paper .rtable td { color: #111; border-color: #ccc; }
.paper .rth .rname { color: #111; font-family: inherit; }
.paper .rnil { color: #888; }
@media (max-width: 640px) { .paper { padding: 16px 12px; } .phead3, .phead2, .psigns { grid-template-columns: 1fr; } }

/* ---- in ---- */
#printroot { display: none; }
@media print {
	@page { size: A4; margin: 10mm; }
	body.printing > *:not(#printroot) { display: none !important; }
	body.printing #printroot { display: block; }
	body.printing { background: #fff !important; }
	#printroot .ppages { display: block; }
	#printroot .paper { width: auto; min-height: 0; padding: 0; box-shadow: none; border-radius: 0; page-break-after: always; }
	#printroot .paper:last-child { page-break-after: auto; }
}
.psign i { display: block; }
/* mẫu tờ khai */
.pformbox { float: right; width: 62mm; max-width: 45%; border: 1px solid #333; padding: 4px 8px; text-align: center; font-size: 11.5px; margin: 0 0 6px 10px; }
.pformbox b, .pformbox i { display: block; }
.pcenter { text-align: center; }
.ptk .pnation { clear: none; margin: 4px 0 10px; }
.ptk h1 { clear: both; margin-top: 6px; }
.ptk .psub { margin-bottom: 8px; }
.pfhead { margin: 8px 0; }
.pfhead .pbold .pk { font-weight: 700; color: #111; }
.pdots { color: #777; letter-spacing: .05em; }
.punit { text-align: right; font-style: italic; margin: 6px 0 2px; }
.psec { font-size: 14px; margin: 12px 0 4px; }
.pftable td { white-space: normal; }
.pftable .pname { min-width: 45%; }
.pftable tr.pb .pname { font-weight: 700; }
.pftable tr.pi .pname { font-style: italic; }
.pftable .pcode { white-space: nowrap; font-weight: 700; text-align: center; width: 1%; }
.pftable .pval { min-width: 90px; }
.pftable .pempty { background: #fafafa; }
.pwarnline { border: 1px solid #c90; background: #fff8e6; padding: 6px 8px; font-size: 12.5px; }
.pextra { margin-top: 10px; padding: 6px 8px; border: 1px dashed #999; font-size: 12.5px; }
.pnoteline { font-style: italic; font-size: 12.5px; }
.pcommit { margin-top: 12px; }
.pfsigns .psign b { text-transform: none; }
.psigner { margin-top: 10px; font-weight: 700; }
.paper { text-align: left; } .paper .pcenter, .paper h1, .paper .ptitle, .paper .psigns, .paper .phead2, .paper .pfoot { text-align: center; } .paper .pform, .paper .punit { text-align: right; }

body[data-mode="xml"] { --ac: #ffb547; --ac2: #ff6f61; --ac-on: #2a1300; --ac-rgb: 255, 181, 71; }
