/* 文档书架 */
:root {
  --bg: #f4f5f8; --panel: #ffffff; --panel2: #f1f3f7; --hover: #eef1f6; --text: #191c23; --text2: #3d4350; --muted: #6b7280;
  --line: #e3e6ec; --line2: #d5dae3; --accent: #3557d4; --accent-2: #2a47b3; --accent-weak: #e9eefc; --accent-text: #ffffff;
  --danger: #d0342c; --danger-weak: #fdecea; --ok: #1f8a4c; --warn: #b4690e; --sel: #dfe7fd; --cut: .42;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06); --shadow: 0 4px 16px rgba(16,24,40,.08), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 18px 50px rgba(16,24,40,.18), 0 4px 12px rgba(16,24,40,.08);
  --r: 14px; --r-sm: 10px; --r-lg: 20px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --tabh: 60px; --toph: 56px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, "Noto Sans Mono CJK SC", monospace;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0e1015; --panel: #171a21; --panel2: #1e222b; --hover: #232833; --text: #e9ebf0; --text2: #c3c8d2; --muted: #9aa2b1;
  --line: #2a2f3a; --line2: #363c49; --accent: #7d9bff; --accent-2: #98b0ff; --accent-weak: #1e2846; --accent-text: #0b1020;
  --danger: #ff6b61; --danger-weak: #3a1d1c; --ok: #4ccf86; --warn: #f0b252; --sel: #243259;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 4px 18px rgba(0,0,0,.35); --shadow-lg: 0 18px 50px rgba(0,0,0,.55);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-text-size-adjust: 100%; }
body { overflow: hidden; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
a { color: var(--accent); }
kbd { font: 11px/1 var(--mono); padding: 3px 5px; border-radius: 5px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); }
.i { width: 20px; height: 20px; flex: none; display: block; }
.muted { color: var(--muted); }
.hint { color: var(--muted); margin: 0 0 12px; font-size: 14px; }
.hint.tiny { font-size: 12.5px; margin: 14px 2px 0; }
.center { text-align: center; }
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.boot-logo { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); opacity: .25; animation: pulse 1.2s infinite ease-in-out; }
@keyframes pulse { 50% { opacity: .6; transform: scale(.9); } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 12px; background: var(--panel2); color: var(--text); font-weight: 600; font-size: 14.5px; white-space: nowrap; transition: background .15s, transform .1s, box-shadow .15s; border: 1px solid var(--line); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:hover:not(:disabled) { background: var(--hover); }
.btn .i { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text2); }
.btn.ghost:hover:not(:disabled) { background: var(--hover); }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.big { min-height: 50px; font-size: 16px; width: 100%; border-radius: 14px; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 12px; color: var(--text2); flex: none; transition: background .15s; }
.icon-btn:hover:not(:disabled) { background: var(--hover); }
.icon-btn:active:not(:disabled) { background: var(--line); }
.icon-btn.sm { width: 38px; height: 38px; border-radius: 10px; }
.icon-btn.danger { color: var(--danger); }
.input { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel); color: var(--text); font: 16px var(--font); outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); gap: 2px; flex: none; }
.seg button { min-height: 36px; padding: 0 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }
.seg.sm button { min-height: 32px; padding: 0 11px; font-size: 13.5px; }
.badge, .pill { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent-weak); color: var(--accent); font-size: 12px; font-weight: 700; }

/* login */
body.locked { overflow: auto; }
.login { min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + var(--sat)) 20px calc(24px + var(--sab));
  background: radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 34px 26px 26px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px; text-align: center; animation: rise .35s ease-out; }
.login-card .logo { width: 60px; height: 60px; margin: 0 auto 2px; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #8b5cf6)); color: #fff; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent); }
.login-card .logo .i { width: 30px; height: 30px; }
.login-card h1 { margin: 0; font-size: 24px; letter-spacing: .5px; }
.login-card p { margin: -8px 0 8px; }
.field { position: relative; display: block; }
.field > span, .field > .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.field .input { padding-left: 42px; }
.login-err { color: var(--danger); min-height: 1.4em; margin: 0 !important; font-size: 14px; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* shell */
.shell { height: 100dvh; display: flex; flex-direction: column; }
.topbar { flex: none; display: flex; align-items: center; gap: 4px; min-height: calc(var(--toph) + var(--sat)); padding: var(--sat) calc(8px + var(--sar)) 0 calc(8px + var(--sal)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); position: relative; z-index: 5; }
.tb-title { flex: 1; min-width: 0; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.tb-logo { width: 44px; height: 44px; display: grid; place-items: center; color: var(--accent); flex: none; }
.tb-logo .i { width: 24px; height: 24px; }
.panes { flex: 1; min-height: 0; position: relative; }
.pane { display: none; min-height: 0; }
body[data-tab="files"] .pane-files { display: flex; }
body[data-tab="export"] .pane-side, body[data-tab="configs"] .pane-side, body[data-tab="more"] .pane-side { display: block; }
.pane-files { flex-direction: column; height: 100%; }
.pane-side { height: 100%; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding: 0 calc(12px + var(--sar)) 24px calc(12px + var(--sal)); }
.side-tabs { display: none !important; }
.side-body { display: none; }
body[data-tab="export"] .side-export, body[data-tab="configs"] .side-configs, body[data-tab="more"] .side-more { display: block; }

/* tabbar */
.tabbar, .selbar { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); padding: 0 var(--sar) var(--sab) var(--sal); background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); z-index: 6; }
.selbar { display: none; grid-template-columns: repeat(6, 1fr); }
body.selecting .tabbar { display: none; }
body.selecting .selbar { display: grid; animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.tab { position: relative; height: var(--tabh); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--muted); transition: color .15s; }
.tab .i { width: 23px; height: 23px; transition: transform .2s; }
.tab.on { color: var(--accent); }
.tab.on .i { transform: translateY(-1px); }
.tab.danger { color: var(--danger); }
.tab-badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-text); font-size: 11px; line-height: 18px; text-align: center; font-style: normal; }
.fab { position: fixed; right: calc(18px + var(--sar)); bottom: calc(var(--tabh) + 18px + var(--sab)); width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: var(--accent-text); display: none; place-items: center; box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 40%, transparent); z-index: 7; transition: transform .15s, bottom .2s; }
.fab .i { width: 26px; height: 26px; }
.fab:active { transform: scale(.94); }
body[data-tab="files"]:not(.selecting) .fab { display: grid; }
body.has-clip[data-tab="files"] .fab { bottom: calc(var(--tabh) + 18px + var(--sab)); }

/* files */
.files-head { flex: none; padding: 0 calc(12px + var(--sar)) 6px calc(12px + var(--sal)); }
.crumbs { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.crumbs::-webkit-scrollbar { display: none; }
.crumb { display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 0 10px; border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 500; flex: none; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; }
.crumb .i { width: 16px; height: 16px; }
.crumb.cur { color: var(--text); background: var(--panel); box-shadow: var(--shadow-sm); border: 1px solid var(--line); font-weight: 600; }
.crumb-sep { color: var(--line2); flex: none; }
.crumbs.small .crumb { min-height: 32px; font-size: 13.5px; }
.filelist { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding: 4px calc(10px + var(--sar)) 0 calc(10px + var(--sal)); outline: none; }
.list-pad { height: 96px; }
.row { position: relative; display: flex; align-items: center; gap: 4px; min-height: 62px; padding: 6px 2px 6px 4px; border-radius: 14px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: pointer; transition: background .15s, opacity .2s; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 96px; right: 10px; height: 1px; background: var(--line); }
.row.sel + .row::before, .row.sel::before { display: none; }
.row:active { background: var(--hover); }
.row.sel { background: var(--sel); }
.row.cut { opacity: var(--cut); }
.row.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0%, 30% { background: var(--accent-weak); } }
.chk, .chk-ph, .selchk { width: 44px; height: 44px; flex: none; display: grid; place-items: center; }
.chk::before, .selchk::before { content: ""; grid-area: 1/1; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line2); background: var(--panel); transition: all .15s; }
.chk .i, .selchk .i { grid-area: 1/1; width: 15px; height: 15px; color: var(--accent-text); stroke-width: 3; z-index: 1; }
.chk.on::before, .chk.part::before { background: var(--accent); border-color: var(--accent); }
.chk:active::before { transform: scale(.88); }
.selchk::before { border-radius: 7px; }
.selchk.on::before { background: var(--accent); border-color: var(--accent); }
.ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--panel2); color: var(--muted); }
.ico .i { width: 21px; height: 21px; }
.ico.folder { background: color-mix(in srgb, #f2a93b 18%, var(--panel)); color: #d38a12; }
.ico.book { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); color: var(--accent); }
.ico.text { background: color-mix(in srgb, #3b82f6 12%, var(--panel)); color: #3b7be6; }
.ico.md { background: color-mix(in srgb, #8b5cf6 13%, var(--panel)); color: #8458ea; }
.ico.zip { background: color-mix(in srgb, #64748b 15%, var(--panel)); color: #64748b; }
.ico.img { background: color-mix(in srgb, #10b981 14%, var(--panel)); color: #0f9b6c; }
.nm { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 0 8px 0 10px; }
.nm .t { font-weight: 600; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nm .sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 8px; }
.more { width: 44px; height: 44px; display: grid; place-items: center; color: var(--muted); border-radius: 12px; flex: none; }
.more:active { background: var(--line); }
.clipbar { flex: none; display: flex; align-items: center; gap: 8px; margin: 0 calc(12px + var(--sar)) 8px calc(12px + var(--sal)); padding: 6px 6px 6px 14px; border-radius: 14px; background: var(--accent-weak); color: var(--accent); animation: rise .2s; }
.clipbar[hidden] { display: none; }
.clip-t { flex: 1; font-weight: 600; font-size: 14px; color: var(--text); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* empty */
.empty { text-align: center; padding: 56px 24px 40px; color: var(--muted); animation: rise .3s ease-out; }
.empty.small { padding: 40px 20px; }
.empty-art { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 22px; display: grid; place-items: center; background: var(--accent-weak); color: var(--accent); }
.empty-art .i { width: 34px; height: 34px; }
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 17px; }
.empty p { margin: 0 auto; font-size: 14px; max-width: 320px; line-height: 1.7; }
.empty-btns { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

/* document pane (mobile: full screen overlay) */
.pane-doc { position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100dvh); z-index: 30; background: var(--panel); display: flex; flex-direction: column; transform: translateX(104%); transition: transform .26s cubic-bezier(.2,.8,.2,1); visibility: hidden; }
body.doc-open .pane-doc { transform: none; visibility: visible; }
.doc-head { flex: none; display: flex; align-items: center; gap: 6px; padding: calc(6px + var(--sat)) calc(8px + var(--sar)) 6px calc(4px + var(--sal)); border-bottom: 1px solid var(--line); background: var(--panel); }
.doc-title { flex: 1; min-width: 0; }
.doc-title .t { font-weight: 700; font-size: 16px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.doc-title .sub { font-size: 12px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; display: inline-block; }
.doc-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.editor { flex: 1; width: 100%; min-height: 100%; border: 0; outline: none; resize: none; padding: 16px calc(16px + var(--sar)) 40px calc(16px + var(--sal)); background: var(--panel); color: var(--text); font: 16px/1.75 var(--font); tab-size: 4; }
.doc-foot { flex: none; display: flex; justify-content: space-between; gap: 10px; padding: 6px calc(16px + var(--sar)) calc(6px + var(--sab)) calc(16px + var(--sal)); font-size: 12px; border-top: 1px solid var(--line); background: var(--panel); }
.doc-empty { margin: auto; text-align: center; padding: 40px 24px; color: var(--muted); max-width: 440px; }
.doc-empty h3 { color: var(--text); margin: 0 0 6px; word-break: break-all; }
.doc-empty p { margin: 0 0 18px; line-height: 1.7; font-size: 14px; }
.kbd-tips { display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; font-size: 12.5px; }
.kbd-tips span { display: inline-flex; gap: 4px; align-items: center; }
.doc-head .btn.primary span { display: inline; }
@media (max-width: 1023px) { .doc-head .seg + .btn span { display: none; } .doc-head .seg + .btn { padding: 0 11px; } .doc-head .seg.sm button { padding: 0 9px; } }

/* markdown */
.md-body { padding: 18px calc(20px + var(--sar)) 40px calc(20px + var(--sal)); line-height: 1.8; font-size: 16px; overflow-wrap: anywhere; max-width: 820px; width: 100%; margin: 0 auto; }
.md-body h1, .md-body h2, .md-body h3 { line-height: 1.35; margin: 1.4em 0 .6em; }
.md-body h1 { font-size: 1.6em; } .md-body h2 { font-size: 1.32em; padding-bottom: .25em; border-bottom: 1px solid var(--line); } .md-body h3 { font-size: 1.12em; }
.md-body > :first-child { margin-top: 0; }
.md-body code { font: .9em var(--mono); background: var(--panel2); padding: 2px 5px; border-radius: 6px; }
.md-body pre { background: var(--panel2); padding: 14px; border-radius: 12px; overflow: auto; }
.md-body pre code { background: none; padding: 0; }
.md-body blockquote { margin: 1em 0; padding: 4px 16px; border-left: 4px solid var(--accent-weak); color: var(--text2); }
.md-body table { border-collapse: collapse; display: block; overflow: auto; }
.md-body td, .md-body th { border: 1px solid var(--line); padding: 6px 10px; }
.md-body img { max-width: 100%; }
.md-body hr { border: 0; border-top: 1px solid var(--line2); margin: 2em 0; }

/* export */
.exp-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 10px 2px; margin: 0 -2px; background: var(--bg); }
.exp-count { flex: 1; min-width: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-count b { font-size: 22px; font-weight: 800; color: var(--accent); margin-right: 2px; font-variant-numeric: tabular-nums; }
.cfg-active { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; margin-bottom: 10px; border-radius: 12px; background: var(--accent-weak); color: var(--accent); font-size: 13.5px; font-weight: 600; }
.cfg-active span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--text); }
.cfg-active .i { width: 17px; height: 17px; }
.exp-opts { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; padding: 12px; margin-bottom: 12px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; font-size: 14px; font-weight: 500; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 40px; height: 24px; border-radius: 12px; background: var(--line2); position: relative; transition: background .2s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.exp-list { display: flex; flex-direction: column; gap: 8px; }
.card { display: flex; align-items: center; gap: 2px; min-height: 64px; padding: 4px 4px 4px 0; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .2s; }
.card.flash { animation: flash 1s ease-out; }
.card .handle { width: 40px; height: 56px; display: grid; place-items: center; color: var(--muted); cursor: grab; touch-action: none; flex: none; }
.card .handle .i { width: 18px; height: 18px; }
.card .idx { width: 22px; flex: none; font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.card .nm { padding: 0 4px 0 6px; }
.card .nm .t { font-size: 15px; }
.card .ext { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.card .sub span:first-child { overflow: hidden; text-overflow: ellipsis; }
.card .cc { flex: none; }
.card-btns { display: flex; flex: none; }
.card-btns button { width: 36px; height: 44px; display: grid; place-items: center; color: var(--text2); border-radius: 10px; }
.card-btns button .i { width: 18px; height: 18px; }
.card-btns button:active:not(:disabled) { background: var(--hover); }
.card-btns button:hover:not(:disabled) { background: var(--hover); }
.card-btns .rm { color: var(--danger); }
.card-ghost { opacity: .35; }
.card-chosen, .sortable-fallback { box-shadow: var(--shadow-lg) !important; transform: scale(1.02); border-color: var(--accent) !important; }
.sortable-drag { opacity: .95 !important; }
.exp-foot { display: flex; gap: 10px; justify-content: space-between; margin-top: 16px; }
.exp-foot .btn { flex: 1; }

/* configs */
.cfg-list { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; }
.cfg { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); padding: 12px; transition: border-color .2s; }
.cfg.active { border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.cfg-main { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.cfg-main .nm { padding: 0; }
.cfg-main .nm .sub { white-space: normal; }
.cfg-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-weak); color: var(--accent); flex: none; }
.cfg .warn { color: var(--warn); font-size: 12.5px; margin-top: 2px; }
.cfg-btns { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; }
.cfg-btns .btn { flex: 1; }

/* more */
.group { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-top: 14px; box-shadow: var(--shadow-sm); }
.li { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 6px 14px; text-align: left; font-size: 15.5px; }
.li + .li { border-top: 1px solid var(--line); }
.li > span:first-of-type { flex: 1; min-width: 0; }
.li .i:first-child { color: var(--accent); }
.li .chev { color: var(--line2); width: 18px; height: 18px; }
.li:active:not(.static) { background: var(--hover); }
.li.danger, .li.danger .i:first-child { color: var(--danger); }
.li.static { cursor: default; flex-wrap: wrap; }

/* sheets */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(10,12,18,.42); opacity: 0; transition: opacity .22s; }
.sheet { position: relative; width: 100%; max-height: calc(var(--vvh, 100dvh) - var(--sat) - 24px); display: flex; flex-direction: column; background: var(--panel); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg); transform: translateY(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1); padding-bottom: var(--sab); }
.sheet-wrap.in .sheet-bg { opacity: 1; }
.sheet-wrap.in .sheet { transform: none; }
.sheet-wrap.tall .sheet { height: calc(var(--vvh, 100dvh) - var(--sat) - 24px); }
.sheet-grip { width: 38px; height: 5px; border-radius: 3px; background: var(--line2); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; padding: 4px 8px 0 20px; flex: none; }
.sheet-head h3 { flex: 1; margin: 0; font-size: 17px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sheet-body { padding: 8px 18px 14px; overflow-y: auto; overflow-x: hidden; flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; }
.sheet-actions { display: flex; gap: 10px; padding: 10px 18px 14px; border-top: 1px solid var(--line); flex: none; }
.sheet-actions .btn { flex: 1; }
.menu-list { display: flex; flex-direction: column; padding-bottom: 4px; }
.menu-sub { color: var(--muted); font-size: 13px; margin: -2px 2px 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.menu-item { display: flex; align-items: center; gap: 14px; min-height: 50px; padding: 0 10px; border-radius: 12px; text-align: left; font-size: 15.5px; }
.menu-item span { flex: 1; }
.menu-item .i { color: var(--text2); }
.menu-item:hover:not(:disabled), .menu-item:active:not(:disabled) { background: var(--hover); }
.menu-item.danger, .menu-item.danger .i { color: var(--danger); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.new-sheet .dest { display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 12px; border-radius: 12px; background: var(--panel2); margin-bottom: 14px; font-size: 14px; }
.new-sheet .dest b { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.grid-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-btns button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 92px; padding: 10px 6px; border-radius: 16px; background: var(--panel2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; text-align: center; transition: background .15s, transform .1s; }
.grid-btns button .i { width: 26px; height: 26px; color: var(--accent); }
.grid-btns button:active { transform: scale(.96); background: var(--hover); }
.grid-btns button:hover { background: var(--hover); }
.picker .crumbs { margin-bottom: 10px; }
.picker-list { display: flex; flex-direction: column; gap: 2px; }
.picker-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 10px; border-radius: 12px; text-align: left; font-size: 15px; }
.picker-row span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.picker-row .i:first-child { color: #d38a12; }
.picker-row .chev { color: var(--line2); }
.picker-row:hover:not(:disabled), .picker-row:active:not(:disabled) { background: var(--hover); }
.picker-empty { color: var(--muted); padding: 24px; text-align: center; font-size: 14px; }

/* preview */
.preview { display: flex; flex-direction: column; height: 100%; gap: 10px; }
.pv-stats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; color: var(--muted); }
.pv-stats b { color: var(--text); font-size: 16px; }
.pv-seg { align-self: flex-start; }
.pv-text { flex: 1; min-height: 0; margin: 0; padding: 14px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; overflow: auto; font: 14px/1.75 var(--font); }
.pv-md { flex: 1; min-height: 0; overflow: auto; border-radius: 12px; border: 1px solid var(--line); padding: 14px; }
.loading { color: var(--muted); padding: 30px; text-align: center; }

/* search */
.search { display: flex; flex-direction: column; height: 100%; }
.search-field { flex: none; margin-bottom: 8px; }
.sr-list { flex: 1; min-height: 0; overflow-y: auto; }
.sr-hint { padding: 28px 10px; text-align: center; font-size: 14px; }
.sr { width: 100%; display: flex; gap: 10px; align-items: flex-start; padding: 10px 8px; border-radius: 12px; text-align: left; }
.sr:hover, .sr:active { background: var(--hover); }
.sr .ico { width: 36px; height: 36px; }
.sr .nm { padding: 0; }
.sr .t em { font-style: normal; font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 8px; }
.snip { font-size: 13px; color: var(--text2); margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-all; }
mark { background: color-mix(in srgb, #facc15 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* trash */
.tr { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tr:last-child { border-bottom: 0; }
.tr .ico { width: 36px; height: 36px; }
.tr .nm { padding: 0 4px; }
.tr .nm .sub { white-space: normal; }

/* toast */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabh) + 16px + var(--sab)); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 520px; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; background: #1f232c; color: #f2f4f8; box-shadow: var(--shadow-lg); font-size: 14.5px; opacity: 0; transform: translateY(10px) scale(.98); transition: all .22s; }
[data-theme="dark"] .toast { background: #2b303b; }
.toast.in { opacity: 1; transform: none; }
.toast.err { background: #b42318; }
.toast.ok::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #4ade80; flex: none; }
.toast-act { color: #9db4ff; font-weight: 700; padding: 6px 4px; }
.toast.progress { flex-direction: column; align-items: stretch; gap: 6px; min-width: 260px; }
.pg { height: 6px; border-radius: 3px; background: rgba(255,255,255,.16); overflow: hidden; }
.pg i { display: block; height: 100%; width: 0; background: #9db4ff; transition: width .2s; }
.pg-s { font-size: 12px; color: #aab3c5; }
.pg-t { font-weight: 600; }

/* context menu */
.ctx { position: fixed; z-index: 90; min-width: 220px; padding: 6px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-lg); opacity: 0; transform: scale(.97); transform-origin: top left; transition: opacity .12s, transform .12s; }
.ctx.in { opacity: 1; transform: none; }
.ctx .menu-item { min-height: 36px; font-size: 14px; gap: 10px; border-radius: 9px; }
.ctx .menu-item .i { width: 17px; height: 17px; }

/* ---------- desktop ---------- */
@media (min-width: 1024px) {
  :root { --toph: 60px; }
  body { font-size: 14px; }
  .tabbar, .selbar, .fab { display: none !important; }
  .topbar { gap: 10px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
  .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; width: 300px; color: var(--text); }
  .brand .i { width: 26px; height: 26px; color: var(--accent); }
  .searchbox { flex: 1; max-width: 560px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); text-align: left; }
  .searchbox span { flex: 1; }
  .searchbox:hover { border-color: var(--line2); }
  .tb-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
  .panes { display: grid; grid-template-columns: minmax(300px, 340px) minmax(0, 1fr) minmax(360px, 400px); gap: 14px; padding: 14px; }
  .pane { display: flex !important; flex-direction: column; min-height: 0; height: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); overflow: hidden; }
  .files-head { padding: 12px 10px 8px 16px; border-bottom: 1px solid var(--line); }
  .fh-row { display: flex; align-items: center; gap: 2px; }
  .fh-row h2 { flex: 1; margin: 0; font-size: 15px; }
  .fh-cwd { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-top: 4px; min-width: 0; }
  .fh-cwd .i { width: 15px; height: 15px; }
  .fh-cwd span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .filelist { padding: 6px 6px 20px; }
  .clipbar { margin: 8px 8px 0; }
  .row { min-height: 34px; padding: 1px 6px 1px calc(6px + var(--d, 0) * 16px); border-radius: 8px; gap: 2px; }
  .row + .row::before { display: none; }
  .row:hover { background: var(--hover); }
  .row.sel { background: var(--sel); }
  .row.cwd:not(.sel) { background: color-mix(in srgb, var(--accent) 7%, transparent); }
  .row.opened .nm .t { color: var(--accent); }
  .row.root { padding-left: 8px; gap: 8px; color: var(--text2); }
  .row.root .nm { padding-left: 0; }
  .row.drop { background: var(--accent-weak); outline: 2px dashed var(--accent); outline-offset: -2px; }
  .row.dragging { opacity: .5; }
  .twisty, .twisty-ph { width: 22px; height: 28px; display: grid; place-items: center; flex: none; color: var(--muted); }
  .twisty .i { width: 15px; height: 15px; transition: transform .15s; }
  .twisty.open .i { transform: rotate(90deg); }
  .chk, .chk-ph { width: 28px; height: 28px; }
  .chk::before { width: 17px; height: 17px; border-width: 1.6px; border-radius: 5px; }
  .chk .i { width: 12px; height: 12px; }
  .ico { width: 24px; height: 24px; border-radius: 6px; background: none !important; }
  .ico .i { width: 18px; height: 18px; }
  .nm { padding: 0 6px; }
  .row .nm .t { font-size: 13.5px; font-weight: 500; }
  .row.dir .nm .t { font-weight: 600; }
  .meta { font-size: 11.5px; color: var(--muted); flex: none; padding-left: 4px; }
  .more { width: 28px; height: 28px; border-radius: 7px; opacity: 0; }
  .row:hover .more, .row.sel .more { opacity: 1; }
  .more:hover { background: var(--line); }
  .empty { padding: 30px 16px; }
  .pane-doc { position: static; transform: none; visibility: visible; height: 100%; z-index: auto; transition: none; }
  .doc-head { padding: 8px 10px 8px 8px; min-height: 58px; }
  .editor { padding: 22px 28px 60px; font-size: 15px; }
  .doc-foot { padding: 6px 16px; }
  .md-body { padding: 24px 32px 60px; }
  .pane-side { padding: 0; overflow: hidden; }
  .side-tabs { display: flex !important; margin: 12px 12px 4px; }
  .side-tabs button { flex: 1; justify-content: center; }
  .side-tabs .i { width: 17px; height: 17px; }
  .side-body { display: none !important; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 12px 16px; }
  .pane-side[data-st="export"] .side-export, .pane-side[data-st="configs"] .side-configs { display: block !important; }
  .exp-head { background: var(--panel); padding: 10px 2px; }
  .exp-opts { box-shadow: none; background: var(--panel2); }
  .card { min-height: 54px; box-shadow: none; }
  .card .handle { height: 46px; width: 34px; }
  .card .nm .t { font-size: 14px; }
  .card-btns button { width: 30px; height: 34px; }
  .card-btns button .i { width: 16px; height: 16px; }
  .cfg { box-shadow: none; }
  .btn { min-height: 38px; font-size: 13.5px; }
  .btn.sm { min-height: 34px; font-size: 13px; }
  .icon-btn { width: 38px; height: 38px; }
  .icon-btn.sm { width: 32px; height: 32px; }
  .sheet-wrap { align-items: center; padding: 30px; }
  .sheet { max-width: 460px; border-radius: 20px; transform: translateY(14px) scale(.98); opacity: 0; transition: transform .2s, opacity .2s; padding-bottom: 0; max-height: 86vh; }
  .sheet.wide { max-width: 820px; }
  .sheet-wrap.tall .sheet { height: 82vh; }
  .sheet-wrap.in .sheet { opacity: 1; }
  .sheet-grip { display: none; }
  .sheet-head { padding: 14px 10px 4px 22px; }
  .sheet-body { padding: 8px 22px 16px; }
  .sheet-actions { padding: 12px 22px 16px; justify-content: flex-end; }
  .sheet-actions .btn { flex: none; min-width: 96px; }
  .menu-item { min-height: 42px; font-size: 14.5px; }
  #toasts { bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
