@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-files { --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 6.5h6l2 2h8v10H4z'/%3E%3C/svg%3E"); }
.ic-outline { --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 6h14M8 11h11M11 16h8'/%3E%3C/svg%3E"); }
.ic-bib { --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 4.5h10a3 3 0 0 1 3 3v12H8a3 3 0 0 1-3-3z'/%3E%3Cpath d='M5 16.5a3 3 0 0 1 3-3h10M9 8.5h5'/%3E%3C/svg%3E"); }
.ic-comment { --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.5 5.5h15v10h-8l-4.5 3.5v-3.5H4.5z'/%3E%3C/svg%3E"); }
.ic-history { --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.5 12a7.5 7.5 0 1 0 2.2-5.3L4.5 9'/%3E%3Cpath d='M4.5 4.5V9H9M12 8v4.5l3 2'/%3E%3C/svg%3E"); }
.ic-build { --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 5v14l11-7z'/%3E%3C/svg%3E"); }
.ic-stop { --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='6.5' y='6.5' width='11' height='11' rx='1.5'/%3E%3C/svg%3E"); }
.ic-newfile { --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 3.5h8l4 4v13H6z'/%3E%3Cpath d='M14 3.5v4h4M12 11v6M9 14h6'/%3E%3C/svg%3E"); }
.ic-newfolder { --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 6.5h6l2 2h9v10h-17z'/%3E%3Cpath d='M12 11v5M9.5 13.5h5'/%3E%3C/svg%3E"); }
.ic-upload { --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='M12 15V4.5M7.5 9 12 4.5 16.5 9M4.5 15v4.5h15V15'/%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='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 7h14M10 7V4.5h4V7M7 7l1 12.5h8L17 7'/%3E%3C/svg%3E"); }
.ic-rename { --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.5 19.5h4l10-10-4-4-10 10z'/%3E%3Cpath d='M13 7l4 4'/%3E%3C/svg%3E"); }
.ic-main { --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='M12 4l2.5 5 5.5.8-4 3.9.9 5.5L12 16.6 7.1 19.2l.9-5.5-4-3.9L9.5 9z'/%3E%3C/svg%3E"); }
.ic-tex { --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 3.5h8l4 4v13H6z'/%3E%3Cpath d='M14 3.5v4h4M9 12h6M9 15.5h4'/%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='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='5' width='16' height='14' rx='2'/%3E%3Cpath d='m4 16 4.5-4.5 4 4 2.5-2.5L20 18'/%3E%3Ccircle cx='15' cy='9.5' r='1.4'/%3E%3C/svg%3E"); }
.ic-folder { --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 6.5h6l2 2h9v10h-17z'/%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='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E"); }
.ic-sync { --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 9h12l-3-3M19 15H7l3 3'/%3E%3C/svg%3E"); }
.ic-zout { --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.5'/%3E%3Cpath d='m15.5 15.5 5 5M7.5 10.5h6'/%3E%3C/svg%3E"); }
.ic-zin { --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.5'/%3E%3Cpath d='m15.5 15.5 5 5M7.5 10.5h6M10.5 7.5v6'/%3E%3C/svg%3E"); }
.ic-fitwidth { --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='6' y='5' width='12' height='14' rx='1.5'/%3E%3Cpath d='M2.5 12h3M18.5 12h3M4 10l-1.5 2L4 14M20 10l1.5 2-1.5 2'/%3E%3C/svg%3E"); }
.ic-log { --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 5h14v14H5z'/%3E%3Cpath d='M8 9h8M8 12h8M8 15h5'/%3E%3C/svg%3E"); }
.ic-warn { --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='M12 4 21 19.5H3z'/%3E%3Cpath d='M12 10v4.5M12 17v.5'/%3E%3C/svg%3E"); }
.ic-err { --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='12' cy='12' r='8'/%3E%3Cpath d='M9 9l6 6M15 9l-6 6'/%3E%3C/svg%3E"); }
.ic-info { --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='12' cy='12' r='8'/%3E%3Cpath d='M12 11v5M12 8v.5'/%3E%3C/svg%3E"); }
.ic-template { --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='4' y='4' width='16' height='16' rx='2'/%3E%3Cpath d='M4 9h16M9 9v11'/%3E%3C/svg%3E"); }
.ic-cite { --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 17c3-1 4-3 4-6H6V7h5v4c0 4-2 6.5-5 7.5zM14 17c3-1 4-3 4-6h-4V7h5v4c0 4-2 6.5-5 7.5z'/%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='m5 12.5 4.5 4.5L19 7.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='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 12a7.5 7.5 0 1 0 2.2-5.3L4.5 9'/%3E%3Cpath d='M4.5 4.5V9H9'/%3E%3C/svg%3E"); }
.ic-diff { --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 4v10M2.5 9h9M13.5 18h8'/%3E%3Cpath d='M14 4h6v6'/%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-4m0 0 2-2m-2 2 2 2M4 18h5'/%3E%3C/svg%3E"); }
.ic-cog { --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='12' cy='12' r='3'/%3E%3Cpath d='M12 3.5v3M12 17.5v3M3.5 12h3M17.5 12h3M6 6l2.1 2.1M15.9 15.9 18 18M6 18l2.1-2.1M15.9 8.1 18 6'/%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 LaTeX: vùng làm việc ba khung (bảng bên, mã nguồn, PDF) ===== */
#app.empty .stage .work, #app.empty .mb-r, #app.empty .mb-c { visibility: hidden; }
.work { position: absolute; inset: 0; display: grid; grid-template-columns: 52px var(--sideW, 250px) 6px minmax(260px, 1fr) 6px var(--pdfW, 46%); grid-template-rows: minmax(0, 1fr); gap: 0; padding: 8px 10px 10px 6px; }
.work.noside { grid-template-columns: 52px 0 0 minmax(260px, 1fr) 6px var(--pdfW, 46%); }
.work.noside .side, .work.noside #gutL { display: none; }
.mtabs { display: none; }
.rail { grid-column: 1; } .side { grid-column: 2; } #gutL { grid-column: 3; } .edp { grid-column: 4; } #gutR { grid-column: 5; } .pdfp { grid-column: 6; }
.side, .edp, .pdfp, .rail, .gut { grid-row: 1; }

/* thanh dọc chọn bảng bên */
.rail { display: flex; flex-direction: column; gap: 4px; padding: 2px 4px 0 0; }
.rl { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 7px; border: 0; border-radius: 12px; background: none; color: var(--mu); cursor: pointer; font-size: 10.5px; line-height: 1.1; }
.rl .ic { width: 19px; height: 19px; }
.rl:hover { background: rgba(255, 255, 255, .06); color: var(--tx); }
.rl[aria-pressed="true"] { background: var(--ac-soft); color: var(--ac-ink); }
.rl .cnt { position: absolute; top: 3px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--ac); color: var(--ac-on); font-size: 10px; line-height: 16px; font-style: normal; }
.rl .cnt:empty { display: none; }

.side, .edp, .pdfp { min-width: 0; min-height: 0; border-radius: 16px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); overflow: hidden; display: flex; flex-direction: column; }
.pane { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.ph { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 6px 14px; flex: none; }
.ph h2 { margin: 0; font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--mu); font-weight: 700; }
.pa { display: inline-flex; align-items: center; gap: 2px; }
.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, .08); color: var(--tx); }
.ib[aria-pressed="true"] { color: var(--ac-ink); }
.ib .ic { width: 16px; height: 16px; }
.muted { color: var(--mu2); font-size: 12.5px; padding: 4px 14px; margin: 0; line-height: 1.5; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mu); cursor: pointer; padding-right: 6px; }
.qrow { padding: 0 10px 8px; flex: none; }
.qrow input, .fld input, .fld select, .fld textarea { width: 100%; 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; }
.fld textarea { height: auto; min-height: 150px; padding: 8px 12px; resize: vertical; font: 12.5px/1.5 "JBM", ui-monospace, monospace; }
.qrow input:focus, .fld input:focus, .fld select:focus, .fld textarea:focus { border-color: var(--ac-line); }

/* cây tệp */
.tree, .outl, .bibl, .notes, .vers { list-style: none; margin: 0; padding: 0 6px 12px; overflow: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.tree li { margin: 0; }
.tn { display: flex; align-items: center; gap: 7px; width: 100%; padding: 5px 8px; border: 0; border-radius: 8px; background: none; color: var(--tx); cursor: pointer; font-size: 13px; text-align: left; white-space: nowrap; }
.tn:hover { background: rgba(255, 255, 255, .06); }
.tn[aria-selected="true"] { background: var(--ac-soft); color: var(--ac-ink); }
.tn .ic { width: 15px; height: 15px; color: var(--mu); }
.tn[aria-selected="true"] .ic { color: var(--ac-ink); }
.tn .nm { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.tn .star { width: 12px; height: 12px; color: var(--warn); }
.tn .tw { width: 12px; height: 12px; transition: transform .15s; }
.tn[aria-expanded="true"] .tw { transform: rotate(90deg); }
.tn .acts { display: none; gap: 0; margin-left: auto; }
.tn:hover .acts, .tn:focus-within .acts { display: inline-flex; }
.tn .acts .ib { width: 24px; height: 22px; }
.tn .acts .ib .ic { width: 13px; height: 13px; }
.tree ul { list-style: none; margin: 0; padding: 0 0 0 14px; }

/* mục lục, tham khảo, ghi chú, phiên bản */
.outl button, .bibl li, .notes li, .vers li { width: 100%; text-align: left; border: 0; background: none; color: var(--tx); cursor: pointer; border-radius: 8px; }
.outl button { display: block; padding: 5px 8px; font-size: 13px; line-height: 1.35; }
.outl button:hover { background: rgba(255, 255, 255, .06); }
.outl .l1 { padding-left: 18px; } .outl .l2 { padding-left: 30px; color: var(--mu); } .outl .l3 { padding-left: 42px; color: var(--mu); }
.outl .l-1 { font-weight: 700; }
.bibl li { padding: 7px 9px; display: block; border: 1px solid transparent; margin-bottom: 4px; }
.bibl li:hover { background: rgba(255, 255, 255, .05); border-color: var(--line); }
.bibl .bk { font: 600 12px/1.3 "JBM", ui-monospace, monospace; color: var(--ac-ink); }
.bibl .bt { font-size: 12.5px; line-height: 1.35; margin-top: 2px; }
.bibl .ba { font-size: 11.5px; color: var(--mu); margin-top: 2px; }
.bibl .dup { color: var(--warn); font-size: 11px; margin-left: 6px; }
.notes li { padding: 8px 10px; margin-bottom: 6px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); cursor: default; }
.notes li.done { opacity: .55; }
.notes .nq { font: 11.5px/1.4 "JBM", ui-monospace, monospace; color: var(--mu); border-left: 3px solid #ffd84d; padding-left: 7px; margin-bottom: 5px; white-space: pre-wrap; max-height: 3.2em; overflow: hidden; cursor: pointer; }
.notes .nt { font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.notes .nm2 { display: flex; align-items: center; gap: 4px; margin-top: 5px; font-size: 11px; color: var(--mu2); }
.notes .nm2 .ib { width: 26px; height: 24px; }
.notes .nm2 .sp { flex: 1; }
.vers li { padding: 8px 10px; margin-bottom: 6px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); cursor: default; }
.vers .vl { font-size: 13px; font-weight: 700; }
.vers .vt { font-size: 11.5px; color: var(--mu); margin-top: 1px; }
.vers .va { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }

/* khung mã nguồn */
.edh, .pdh { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); flex: none; min-height: 42px; }
.ftab { font: 600 12.5px/1 "JBM", ui-monospace, monospace; color: var(--tx); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftab .dim { color: var(--mu2); font-weight: 400; }
.editor { flex: 1; min-height: 0; position: relative; }
.editor .cm-editor { position: absolute; inset: 0; }
.cm-note { background: rgba(255, 216, 77, .2); border-bottom: 2px solid rgba(255, 216, 77, .7); }
.cm-synchl { background: rgba(var(--ac-rgb), .22); }
.imgv { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; background: repeating-conic-gradient(#1a2233 0 25%, #141b29 0 50%) 0 0 / 20px 20px; }
.imgv img { max-width: 100%; max-height: 100%; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.imgv p { color: var(--mu); }

/* bảng lỗi */
.probs { flex: none; border-top: 1px solid var(--line); background: rgba(5, 9, 18, .55); }
.probh { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: 0; background: none; color: var(--mu); cursor: pointer; font-size: 12.5px; text-align: left; }
.probh .ic { width: 14px; height: 14px; transition: transform .15s; transform: rotate(-90deg); }
.probh[aria-expanded="true"] .ic { transform: none; }
.probh .bad { color: #ff9ea2; } .probh .wrn { color: #ffd08a; } .probh .okk { color: #8ff0c8; }
.probb { height: min(34vh, 260px); display: flex; flex-direction: column; min-height: 0; }
.ptabs { display: flex; gap: 4px; padding: 0 10px 6px; flex: none; }
.pt { border: 0; background: none; color: var(--mu); padding: 4px 10px; border-radius: 8px; cursor: pointer; font-size: 12px; }
.pt[aria-selected="true"] { background: var(--ac-soft); color: var(--ac-ink); }
.plist { list-style: none; margin: 0; padding: 0 8px 10px; overflow: auto; flex: 1; min-height: 0; }
.plist li { display: grid; grid-template-columns: 18px 1fr; gap: 4px 9px; padding: 7px 8px; border-radius: 9px; cursor: pointer; }
.plist li:hover { background: rgba(255, 255, 255, .05); }
.plist .ic { width: 16px; height: 16px; margin-top: 1px; }
.plist .e .ic { color: var(--bad); } .plist .w .ic { color: var(--warn); } .plist .i .ic { color: var(--mu); }
.plist .pm { font-size: 13px; line-height: 1.4; }
.plist .po { grid-column: 2; font: 11.5px/1.4 "JBM", ui-monospace, monospace; color: var(--mu2); white-space: pre-wrap; word-break: break-word; }
.plist .pl { color: var(--ac-ink); font: 11.5px "JBM", ui-monospace, monospace; margin-right: 6px; }
.praw { margin: 0; padding: 4px 14px 12px; overflow: auto; flex: 1; min-height: 0; font: 11.5px/1.45 "JBM", ui-monospace, monospace; color: var(--mu); white-space: pre-wrap; word-break: break-word; }

/* khung PDF */
.pginfo { font-size: 12.5px; color: var(--mu); font-variant-numeric: tabular-nums; white-space: nowrap; }
.zl { min-width: 50px; height: 28px; padding: 0 4px; border: 0; border-radius: 8px; background: none; color: var(--tx); cursor: pointer; font: 600 12px/1 "BVP", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.zl:hover { background: rgba(255, 255, 255, .08); }
.pdfv { flex: 1; min-height: 0; overflow: auto; position: relative; background: #2a2f3a; padding: 14px 0 24px; outline: none; overscroll-behavior: contain; }
.pdfv.stale::after { content: "Bản PDF cũ: lần biên dịch mới bị lỗi"; position: sticky; bottom: 10px; left: 0; display: block; width: max-content; margin: 10px auto 0; padding: 6px 12px; border-radius: 999px; background: rgba(239, 106, 112, .9); color: #fff; font-size: 12px; }
.pg { position: relative; margin: 0 auto 14px; background: #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, .45); }
.pg canvas { display: block; width: 100%; height: 100%; }
.pg .textLayer { position: absolute; inset: 0; overflow: hidden; line-height: 1; opacity: 1; -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; caret-color: CanvasText; z-index: 0; }
.pg .textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.pg .textLayer ::selection { background: rgba(0, 90, 255, .28); }
.pg .textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; }
.pg .hl { position: absolute; background: rgba(var(--ac-rgb), .28); outline: 2px solid rgba(var(--ac-rgb), .8); border-radius: 2px; pointer-events: none; z-index: 2; animation: hlfade 2.6s ease-out forwards; }
@keyframes hlfade { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
.pdfempty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #b7c0cf; text-align: center; padding: 20px; }
.pdfempty p { max-width: 280px; line-height: 1.6; }
.pdfempty.err { color: #ffb4b6; }

.gut { cursor: col-resize; position: relative; }
.gut::after { content: ""; position: absolute; top: 40%; bottom: 40%; left: 2px; width: 2px; border-radius: 2px; background: var(--line-2); opacity: 0; transition: opacity .2s; }
.gut:hover::after, .gut.drag::after { opacity: 1; }

/* màn hình đầu: dự án gần đây */
.plist2 { list-style: none; margin: 26px auto 0; padding: 0; max-width: 520px; text-align: left; display: grid; gap: 6px; }
.plist2 li { display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .035); }
.plist2 li:hover { border-color: var(--line-2); background: rgba(255, 255, 255, .06); }
.plist2 .po2 { flex: 1; min-width: 0; border: 0; background: none; color: var(--tx); text-align: left; cursor: pointer; padding: 0; }
.plist2 .po2 b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist2 .po2 span { display: block; font-size: 12px; color: var(--mu); margin-top: 1px; }
.kho { margin: 22px auto 0; max-width: 520px; font-size: 12.5px; color: var(--mu); line-height: 1.55; }
.kho.bad { color: #ffb4b6; }

/* hộp thoại lớn: mẫu, so sánh phiên bản */
.modal.wide { max-width: 860px; }
.modal.full { max-width: min(1200px, 96vw); height: min(88vh, 900px); display: flex; flex-direction: column; }
.modal.full .mb { flex: 1; min-height: 0; overflow: auto; padding: 10px 22px; }
.fld { display: block; margin: 10px 0; }
.fld > span { display: block; font-size: 12px; color: var(--mu); margin-bottom: 5px; }
.tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 6px 0 4px; }
.tpl { text-align: left; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .035); color: var(--tx); cursor: pointer; }
.tpl:hover { border-color: var(--line-2); background: rgba(255, 255, 255, .07); }
.tpl[aria-pressed="true"] { border-color: var(--ac-line); background: var(--ac-soft); }
.tpl b { display: block; font-size: 13.5px; }
.tpl span { display: block; font-size: 11.5px; color: var(--mu); margin-top: 4px; line-height: 1.4; }
.tpl .eng { display: inline-block; margin-top: 7px; padding: 1px 7px; border-radius: 6px; background: rgba(255, 255, 255, .08); color: var(--mu); font: 10.5px "JBM", ui-monospace, monospace; }
.dfiles { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.dfiles button { border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--tx); border-radius: 9px; padding: 5px 10px; cursor: pointer; font: 12px "JBM", ui-monospace, monospace; }
.dfiles button[aria-pressed="true"] { border-color: var(--ac-line); background: var(--ac-soft); color: var(--ac-ink); }
.dfiles .ad { color: #8ff0c8; } .dfiles .rm { color: #ff9ea2; }
.diff { margin: 0; font: 12px/1.5 "JBM", ui-monospace, monospace; white-space: pre-wrap; word-break: break-word; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.diff div { padding: 0 10px; }
.diff .a { background: rgba(79, 209, 160, .14); color: #c9f7e4; }
.diff .r { background: rgba(239, 106, 112, .14); color: #ffd0d2; text-decoration: line-through; text-decoration-color: rgba(255, 160, 165, .45); }
.diff .c { color: var(--mu); }
.diff .sk { color: var(--mu2); background: rgba(255, 255, 255, .03); text-align: center; }
.diff .ln { display: inline-block; min-width: 3.2em; color: var(--mu2); user-select: none; }

/* bảng cài đặt biên dịch */
.dd.set { padding: 12px 14px; min-width: 300px; }
.dd.set .agrp { margin-bottom: 12px; }
.dd.set .alab { font-size: 11.5px; color: var(--mu); margin-bottom: 6px; letter-spacing: .04em; }
.aseg { display: flex; gap: 4px; flex-wrap: wrap; }
.aseg .btn[aria-pressed="true"] { border-color: var(--ac-line); background: var(--ac-soft); color: var(--ac-ink); }
.dd.set select { width: 100%; height: 34px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, .3); color: var(--tx); padding: 0 8px; }
.dd.set .hint { font-size: 11.5px; color: var(--mu2); line-height: 1.45; margin-top: 6px; }
#bBuild.run .ic { animation: spin 1s linear infinite; -webkit-mask: none; mask: none; background: none; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; width: 15px; height: 15px; }

/* ---- màn hình vừa và hẹp ---- */
@media (max-width: 1100px) {
	.work { grid-template-columns: 52px var(--sideW, 220px) 6px minmax(240px, 1fr) 6px var(--pdfW, 42%); }
}
@media (max-width: 860px) {
	.work, .work.noside { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto; padding: 6px; gap: 6px; }
	.rail { flex-direction: row; justify-content: space-around; padding: 0; }
	.rl { flex-direction: row; gap: 6px; padding: 8px 10px; font-size: 12px; }
	.rl span { display: none; }
	.gut { display: none; }
	.side, .edp, .pdfp { grid-row: 2; grid-column: 1; }
	.rail { grid-row: 1; grid-column: 1; }
	.work .side { display: none; }
	.work.mside .side { display: flex; z-index: 3; }
	.work.mside .edp, .work.mside .pdfp { display: none; }
	.work[data-mt="src"] .pdfp { display: none; }
	.work[data-mt="pdf"] .edp { display: none; }
	.mtabs { display: flex; grid-row: 3; grid-column: 1; gap: 6px; justify-content: center; }
	.mt { flex: 1; max-width: 200px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--mu); cursor: pointer; }
	.mt[aria-selected="true"] { border-color: var(--ac-line); background: var(--ac-soft); color: var(--ac-ink); }
	#bSet span { display: none; }
}

body[data-mode="latex"] { --ac: #b18cff; --ac2: #4f8dff; --ac-on: #140a2e; --ac-rgb: 177, 140, 255; }
