/* ===========================================================
   aide.css —— AIDE 主体：标签条 / 编辑器 / 工具栏 / 控制台 / 抽屉
   =========================================================== */

/* ---------- 文件浏览器：路径面包屑 ---------- */
.pathbar {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 2px;
	padding: 7px 10px;
	background: var(--bg-alt);
	border-bottom: 1px solid var(--line);
	font-size: 12px;
	color: var(--fg-dim);
	overflow-x: auto;
	white-space: nowrap;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}
.pathbar::-webkit-scrollbar { display: none; }
.pathbar .seg { padding: 2px 5px; border-radius: 5px; }
.pathbar .seg:active { background: var(--bg-sunken); }
.pathbar .sepc { color: var(--fg-faint); }

/* 文件类型小图标 */
.ficon {
	width: 34px;
	height: 34px;
	border-radius: 7px;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 700;
	color: #fff;
	letter-spacing: .3px;
}
.ficon.java { background: #b07219; }
.ficon.xml { background: #e37933; }
.ficon.gradle { background: #0b7dbb; }
.ficon.prop { background: #6b7280; }
.ficon.png, .ficon.webp { background: #8e44ad; }
.ficon.json { background: #c9a227; }
.ficon.txt, .ficon.md { background: #7a828e; }
.ficon.directory { background: #f0b429; }
.ficon.directory svg.ic { width: 19px; height: 19px; }

/* ---------- 编辑器标签条 ---------- */
.tabbar {
	flex: 0 0 auto;
	display: flex;
	align-items: stretch;
	gap: 1px;
	height: 34px;
	background: var(--bg-sunken);
	border-bottom: 1px solid var(--line-strong);
	overflow-x: auto;
	overflow-y: hidden;
	scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display: none; }
.tabbar:empty { display: none; }

.tab {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 0 8px 0 11px;
	max-width: 190px;
	font-size: 12.5px;
	color: var(--fg-dim);
	background: var(--bg-sunken);
	border-right: 1px solid var(--line);
	position: relative;
	flex: 0 0 auto;
	transition: background .12s;
}
.tab .tab-name {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 130px;
}
.tab .tab-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--accent);
	flex: 0 0 auto;
	opacity: 0;
}
.tab.dirty .tab-dot { opacity: 1; }
.tab.on {
	background: var(--ed-bg);
	color: var(--fg);
	box-shadow: inset 0 -2px 0 var(--accent);
}
.tab .tab-x {
	width: 20px;
	height: 20px;
	border: 0;
	background: transparent;
	color: var(--fg-faint);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	padding: 0;
}
.tab .tab-x svg.ic { width: 13px; height: 13px; stroke-width: 2.4; }
.tab .tab-x:active { background: var(--bg-sunken); }

/* ---------- 编辑器主体 ---------- */
.editor-wrap {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	background: var(--ed-bg);
	position: relative;
	overflow: hidden;
}

.gutter {
	flex: 0 0 auto;
	width: 44px;
	background: var(--ed-gutter-bg);
	border-right: 1px solid var(--line);
	overflow: hidden;
	position: relative;
	user-select: none;
	-webkit-user-select: none;
}
.gutter-inner {
	will-change: transform;
	padding: 10px 0;
}
.gutter .ln {
	height: var(--ed-lh, 21px);
	line-height: var(--ed-lh, 21px);
	font-family: var(--font-mono);
	font-size: var(--ed-fs, 13px);
	color: var(--ed-gutter-fg);
	text-align: right;
	padding-right: 8px;
	box-sizing: border-box;
	transition: color .1s;
}
.gutter .ln.cur { color: var(--ed-gutter-cur); font-weight: 700; }

.code-scroll {
	flex: 1 1 auto;
	min-width: 0;
	position: relative;
	overflow: hidden;
}

/* 高亮层 与 textarea 完全重叠 */
.hl,
#ta {
	position: absolute;
	top: 0;
	left: 0;
	margin: 0;
	border: 0;
	padding: 10px 12px;
	font-family: var(--font-mono);
	font-size: var(--ed-fs, 13px);
	line-height: var(--ed-lh, 21px);
	letter-spacing: 0;
	tab-size: 4;
	-moz-tab-size: 4;
	white-space: pre;
	word-wrap: normal;
	box-sizing: border-box;
}

.hl {
	right: auto;
	bottom: auto;
	min-width: 100%;
	width: max-content;
	pointer-events: none;
	color: var(--ed-fg);
	background: transparent;
	will-change: transform;
	overflow: visible;
}
.hl code { display: block; font: inherit; }

#ta {
	width: 100%;
	height: 100%;
	overflow: auto;
	resize: none;
	outline: none;
	background: transparent;
	color: transparent;
	caret-color: #1f2328;
	-webkit-text-fill-color: transparent;
	text-shadow: none;
	-webkit-appearance: none;
	z-index: 2;
	-webkit-overflow-scrolling: touch;
}
html[data-theme="dark"] #ta { caret-color: #e6e8eb; }
#ta::selection { background: var(--ed-sel); color: transparent; }

/* 当前行高亮 */
.cur-line {
	position: absolute;
	left: 0;
	right: 0;
	height: var(--ed-lh, 21px);
	background: var(--ed-line-cur);
	pointer-events: none;
	z-index: 0;
	display: none;
}

/* ---------- 语法着色（Eclipse / AIDE） ---------- */
.tok-key { color: var(--tok-key); font-weight: 600; }
.tok-str { color: var(--tok-str); }
.tok-com { color: var(--tok-com); font-style: italic; }
.tok-ann { color: var(--tok-ann); }
.tok-num { color: var(--tok-num); }
.tok-type { color: var(--tok-type); font-weight: 600; }
.tok-tag { color: var(--tok-tag); }
.tok-attr { color: var(--tok-attr); }
.tok-punc { color: var(--tok-punc); }
.tok-plain { color: var(--ed-fg); }

/* ---------- 底部工具栏（AIDE 标志性） ---------- */
.toolbar {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 2px;
	height: 48px;
	padding: 0 6px;
	background: var(--bg-alt);
	border-top: 1px solid var(--line-strong);
}
.tb-btn {
	width: 42px;
	height: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--fg-dim);
}
.tb-btn:active { background: var(--bg-sunken); }
.tb-btn svg.ic { width: 20px; height: 20px; }

.tb-run {
	display: flex;
	align-items: center;
	gap: 6px;
	height: 36px;
	padding: 0 16px 0 13px;
	margin-left: 4px;
	border: 0;
	border-radius: 18px;
	background: var(--run);
	color: #fff;
	font-size: 13.5px;
	font-weight: 700;
	font-family: inherit;
	box-shadow: 0 2px 6px rgba(46, 125, 50, .35);
}
.tb-run:active { background: var(--run-dark); }
.tb-run svg.ic { width: 17px; height: 17px; }
.tb-run svg.ic.solid { fill: #fff; }
.tb-run.building { background: var(--danger); box-shadow: 0 2px 6px rgba(217, 48, 37, .35); }

/* ---------- 状态栏 ---------- */
.statusbar {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 6px;
	height: 22px;
	padding: 0 10px;
	background: var(--bg-sunken);
	border-top: 1px solid var(--line);
	font-size: 11px;
	color: var(--fg-dim);
	font-family: var(--font-mono);
	white-space: nowrap;
	overflow: hidden;
}
.statusbar .sep { color: var(--fg-faint); }
.server-dot { display: inline-flex; align-items: center; gap: 4px; }
.server-dot::before {
	content: "";
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--fg-faint);
}
.server-dot.online { color: var(--ok); }
.server-dot.online::before { background: var(--ok); }
.server-dot.offline { color: var(--fg-faint); }
.server-dot.busy { color: var(--warn); }
.server-dot.busy::before { background: var(--warn); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- 控制台 ---------- */
.console {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	height: 46%;
	max-height: 58%;
	background: var(--con-bg);
	border-top: 1px solid #000;
	transition: height .18s ease-out, max-height .18s;
	overflow: hidden;
}
.console.collapsed {
	height: 0 !important;
	border-top: 0;
}

.console-head {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	height: 36px;
	padding: 0 4px 0 0;
	background: #23262b;
	border-bottom: 1px solid #000;
}
.ctabs { display: flex; align-items: stretch; height: 100%; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.ctabs::-webkit-scrollbar { display: none; }
.ctab {
	display: flex;
	align-items: center;
	gap: 5px;
	padding: 0 12px;
	border: 0;
	background: transparent;
	color: #8b919b;
	font-size: 12.5px;
	font-family: inherit;
	position: relative;
	white-space: nowrap;
}
.ctab.active { color: #e8eaee; box-shadow: inset 0 -2px 0 var(--con-ok); }
.ctab .badge {
	font-style: normal;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: 8px;
	background: var(--danger);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.chead-right { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.chead-right .ab-btn { color: #8b919b; }
.chead-right .ab-btn:active { background: rgba(255, 255, 255, .1); }
.build-state {
	font-size: 11px;
	color: #8b919b;
	padding: 0 6px;
	max-width: 110px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.build-state.ok { color: var(--con-ok); }
.build-state.err { color: var(--con-err); }

.console-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 6px 0 10px;
	font-family: var(--font-mono);
	font-size: 11.5px;
	line-height: 1.62;
	color: var(--con-fg);
	background: var(--con-bg);
}
.console-body .cl {
	padding: 0 10px;
	white-space: pre-wrap;
	word-break: break-all;
	border-left: 2px solid transparent;
}
.console-body .cl.ok { color: var(--con-ok); }
.console-body .cl.err { color: var(--con-err); border-left-color: var(--con-err); background: rgba(244, 135, 113, .07); }
.console-body .cl.warn { color: var(--con-warn); }
.console-body .cl.cmd { color: var(--con-cmd); }
.console-body .cl.dim { color: var(--con-dim); }
.console-body .cl.tap { text-decoration: underline dotted; }
.console-body .cl b { color: #fff; }

.console-empty {
	padding: 18px 14px;
	color: var(--con-dim);
	text-align: center;
	line-height: 1.7;
	font-family: var(--font-ui);
	font-size: 12px;
}

/* ---------- 抽屉（文件树） ---------- */
.drawer {
	position: fixed;
	top: 0;
	bottom: 0;
	left: 0;
	width: 84%;
	max-width: 350px;
	z-index: 80;
	display: flex;
	flex-direction: column;
	background: var(--bg);
	box-shadow: 4px 0 22px rgba(0, 0, 0, .28);
	transform: translateX(-103%);
	transition: transform .22s cubic-bezier(.2, .8, .2, 1);
}
.drawer.open { transform: none; }

.drawer-head {
	flex: 0 0 auto;
	padding: 14px 16px 12px;
	background: var(--ab-bg);
	color: var(--ab-fg);
}
.drawer-title { font-size: 16px; font-weight: 700; }
.drawer-sub { font-size: 11.5px; color: var(--ab-sub); margin-top: 2px; }

.drawer-tree {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 6px 0;
	background: var(--bg);
}

.tnode {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px 8px 0;
	font-size: 13px;
	color: var(--fg);
	position: relative;
}
.tnode:active { background: var(--bg-alt); }
.tnode .tw {
	width: 16px;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--fg-faint);
}
.tnode .tw svg.ic { width: 12px; height: 12px; stroke-width: 2.6; }
.tnode .tname {
	flex: 1 1 auto;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.tnode .tname.dim { color: var(--fg-dim); }
.tnode.dir .tname { font-weight: 600; }
.tnode.on { background: var(--accent-soft); }
.tnode.on .tname { color: var(--accent); font-weight: 600; }
.tnode .tbadge {
	font-size: 10px;
	color: var(--accent);
	background: var(--accent-soft);
	border-radius: 4px;
	padding: 1px 5px;
	font-family: var(--font-mono);
}
.tnode .ticon {
	width: 18px;
	height: 18px;
	border-radius: 4px;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 9px;
	font-weight: 700;
	color: #fff;
}

.drawer-foot {
	flex: 0 0 auto;
	border-top: 1px solid var(--line);
	padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
	background: var(--bg-alt);
}
.drawer-item {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 12px 16px;
	border: 0;
	background: transparent;
	color: var(--fg);
	font-size: 13.5px;
	font-family: inherit;
	text-align: left;
}
.drawer-item:active { background: var(--bg-sunken); }
.drawer-item svg.ic { width: 19px; height: 19px; color: var(--fg-dim); }

.scrim {
	position: fixed;
	inset: 0;
	z-index: 78;
	background: rgba(0, 0, 0, .4);
	animation: fade .16s ease-out;
}

/* ---------- 查找条 ---------- */
.findbar {
	flex: 0 0 auto;
	display: none;
	align-items: center;
	gap: 6px;
	padding: 6px 8px;
	background: var(--bg-alt);
	border-bottom: 1px solid var(--line);
}
.findbar.open { display: flex; }
.findbar input {
	flex: 1 1 auto;
	min-width: 0;
	border: 1px solid var(--line-strong);
	border-radius: 6px;
	background: var(--bg);
	color: var(--fg);
	font-size: 13px;
	font-family: var(--font-mono);
	padding: 7px 9px;
	outline: none;
}
.findbar input:focus { border-color: var(--accent); }
.findbar .fcount {
	font-size: 11px;
	color: var(--fg-dim);
	font-family: var(--font-mono);
	min-width: 42px;
	text-align: center;
}
.findbar .fbtn {
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--fg-dim);
	display: flex;
	align-items: center;
	justify-content: center;
}
.findbar .fbtn:active { background: var(--bg-sunken); }
.findbar .fbtn svg.ic { width: 17px; height: 17px; }

/* ---------- 构建进度条（ActionBar 下方细线） ---------- */
.build-progress {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 2px;
	background: transparent;
	overflow: hidden;
	opacity: 0;
	transition: opacity .2s;
}
.build-progress.on { opacity: 1; }
.build-progress i {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 40%;
	background: var(--con-ok);
	animation: indet 1.15s infinite ease-in-out;
}
@keyframes indet {
	0% { left: -40%; }
	100% { left: 100%; }
}

/* ---------- 小屏适配 ---------- */
@media (max-width: 360px) {
	.gutter { width: 38px; }
	.tb-run { padding: 0 12px; }
	.li-icon { width: 34px; height: 34px; }
}

/* ===========================================================
   新增：ActionBar 文字按钮 / 打包面板 / 表单控件
   =========================================================== */

/* ---------- ActionBar 右侧文字按钮 ---------- */
.ab-actions {
	display: flex;
	align-items: center;
	gap: 4px;
	padding-right: 4px;
	flex: 0 0 auto;
}
.ab-txt {
	border: 0;
	background: transparent;
	color: #cfd3d8;
	font-size: 13.5px;
	font-weight: 600;
	font-family: inherit;
	padding: 8px 11px;
	border-radius: 8px;
	letter-spacing: .3px;
}
.ab-txt:active { background: rgba(255, 255, 255, .14); }
.ab-txt.run {
	background: var(--run);
	color: #fff;
	padding: 8px 16px;
	box-shadow: 0 1px 5px rgba(0, 0, 0, .35);
}
.ab-txt.run:active { background: var(--run-dark); }
.ab-txt.run.busy { background: var(--danger); }

/* ---------- 打包面板（底部弹出） ---------- */
.sheet-wrap {
	position: fixed;
	inset: 0;
	z-index: 100;
	background: rgba(0, 0, 0, .45);
	display: flex;
	align-items: flex-end;
	animation: fade .16s ease-out;
}
.sheet-wrap[hidden] { display: none; }

.sheet {
	width: 100%;
	max-height: 82vh;
	background: var(--bg);
	border-radius: 16px 16px 0 0;
	display: flex;
	flex-direction: column;
	box-shadow: 0 -8px 30px rgba(0, 0, 0, .32);
	animation: slideup .22s cubic-bezier(.2, .8, .2, 1);
	padding-bottom: env(safe-area-inset-bottom, 0px);
}
@keyframes slideup {
	from { transform: translateY(46px); opacity: .55; }
	to { transform: none; opacity: 1; }
}

.sheet-head {
	display: flex;
	align-items: center;
	padding: 14px 10px 6px 18px;
	flex: 0 0 auto;
}
.sheet-title { flex: 1 1 auto; font-size: 16px; font-weight: 700; }
.sheet-head .ab-btn { color: var(--fg-dim); }
.sheet-head .ab-btn:active { background: var(--bg-alt); }

.sheet-body {
	padding: 6px 18px 14px;
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
}

.bs-state {
	font-size: 13.5px;
	color: var(--fg-dim);
	margin-bottom: 10px;
	min-height: 20px;
}
.bs-state.ok { color: var(--ok); font-weight: 600; }
.bs-state.err { color: var(--danger); font-weight: 600; }

.bs-track {
	height: 8px;
	border-radius: 4px;
	background: var(--bg-sunken);
	overflow: hidden;
}
.bs-track i {
	display: block;
	height: 100%;
	width: 0;
	border-radius: 4px;
	background: linear-gradient(90deg, #43a047, #66bb6a);
	transition: width .35s ease;
}
.bs-track.fail i { background: var(--danger); }
.bs-track.done i { background: linear-gradient(90deg, #2e7d32, #66bb6a); }

.bs-meta {
	display: flex;
	justify-content: space-between;
	font-size: 11.5px;
	color: var(--fg-faint);
	margin-top: 6px;
	font-family: var(--font-mono);
}

.bs-log {
	margin-top: 12px;
	padding: 8px 10px;
	border-radius: 8px;
	background: var(--con-bg);
	color: var(--con-fg);
	font-family: var(--font-mono);
	font-size: 11px;
	line-height: 1.55;
	max-height: 128px;
	overflow-y: auto;
	white-space: pre-wrap;
	word-break: break-all;
}
.bs-log:empty { display: none; }
.bs-log .ok { color: var(--con-ok); }
.bs-log .err { color: var(--con-err); }
.bs-log .dim { color: var(--con-dim); }

.sheet-foot {
	display: flex;
	gap: 8px;
	padding: 10px 14px 14px;
	border-top: 1px solid var(--line);
	flex: 0 0 auto;
}
.sheet-foot .btn { flex: 1 1 0; }
.sheet-foot[hidden] { display: none; }

/* 成功卡片 */
.bs-done {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 0 4px;
}
.bs-done .ok-ic {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--run);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
}
.bs-done .ok-ic svg.ic { width: 24px; height: 24px; stroke-width: 2.6; }
.bs-done .ok-main { min-width: 0; }
.bs-done .ok-title { font-size: 15px; font-weight: 700; }
.bs-done .ok-sub { font-size: 12px; color: var(--fg-dim); margin-top: 2px; word-break: break-all; }

/* ---------- 对话框表单控件 ---------- */
.dlg-field select,
.dlg-field .seg {
	width: 100%;
	box-sizing: border-box;
}
.dlg-field select {
	padding: 10px 12px;
	border: 1px solid var(--line-strong);
	border-radius: 8px;
	background: var(--bg-alt);
	color: var(--fg);
	font-size: 14px;
	font-family: inherit;
	outline: none;
	appearance: none;
}
.dlg-field select:focus { border-color: var(--accent); background: var(--bg); }

.seg {
	display: flex;
	border: 1px solid var(--line-strong);
	border-radius: 8px;
	overflow: hidden;
	background: var(--bg-alt);
}
.seg button {
	flex: 1 1 0;
	border: 0;
	background: transparent;
	color: var(--fg-dim);
	font-size: 13.5px;
	font-weight: 600;
	font-family: inherit;
	padding: 10px 0;
}
.seg button.on { background: var(--accent); color: #fff; }

/* 图标选择 */
.icon-pick {
	display: flex;
	align-items: center;
	gap: 14px;
}
.icon-preview {
	width: 58px;
	height: 58px;
	border-radius: 14px;
	background: linear-gradient(140deg, #8bc34a, #4caf50 55%, #2e7d32);
	border: 1px solid var(--line);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	flex: 0 0 auto;
	color: #fff;
	font-weight: 800;
	font-size: 24px;
}
.icon-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.icon-pick .btn { flex: 0 0 auto; }

/* 配置页只读行 */
.cfg-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 11px 0;
	border-bottom: 1px solid var(--line);
	font-size: 13.5px;
}
.cfg-row:last-child { border-bottom: 0; }
.cfg-row .k { color: var(--fg-dim); flex: 0 0 auto; }
.cfg-row .v {
	flex: 1 1 auto;
	text-align: right;
	color: var(--fg);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-family: var(--font-mono);
	font-size: 12.5px;
}

/* 打包按钮忙碌态 */
.ab-txt.run .spin {
	display: inline-block;
	width: 11px;
	height: 11px;
	border: 2px solid rgba(255, 255, 255, .45);
	border-top-color: #fff;
	border-radius: 50%;
	margin-right: 6px;
	vertical-align: -1px;
	animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 下载 / 保存进度区 ---------- */
.dl-box {
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px dashed var(--line);
}
.dl-box[hidden] { display: none; }

.dl-label {
	font-size: 13px;
	line-height: 1.5;
	color: var(--fg);
	margin-bottom: 8px;
	word-break: break-all;
}
.dl-label.err { color: var(--danger); font-weight: 600; }

.dl-track { height: 8px; }
.dl-track.done i { background: linear-gradient(90deg, #2e7d32, #66bb6a); }
.dl-track.fail i { background: var(--danger); }

.dl-path {
	margin-top: 9px;
	padding: 8px 10px;
	border-radius: 8px;
	background: var(--bg-alt);
	border: 1px solid var(--line);
	color: var(--fg-dim);
	font-family: var(--font-mono);
	font-size: 11.5px;
	line-height: 1.5;
	word-break: break-all;
	user-select: text;
	-webkit-user-select: text;
	white-space: pre-wrap;
}
.dl-path[hidden] { display: none; }

.dl-acts {
	display: flex;
	gap: 8px;
	margin-top: 8px;
}
.dl-acts[hidden] { display: none; }
.dl-acts .btn { flex: 0 0 auto; }

/* 无进度回调时的循环动画（避免看起来没动） */
.dl-track.indet i {
	width: 35% !important;
	animation: dlindet 1.15s infinite ease-in-out;
}
@keyframes dlindet {
	0% { margin-left: -35%; }
	100% { margin-left: 100%; }
}

/* ===========================================================
   应用头像 / AI 全屏聊天
   =========================================================== */

.ab-logo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 8px;
	display: block;
}

/* AI 按钮在工具栏里高亮一点 */
.tb-btn.tb-ai { color: #7c5cff; }
.tb-btn.tb-ai:active { background: rgba(124, 92, 255, .12); }

/* ---------- AI 聊天 ---------- */
#view-ai { background: var(--bg); }

.ai-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 12px 12px 4px;
	background: var(--bg-alt);
}

.ai-empty {
	padding: 50px 24px;
	text-align: center;
	color: var(--fg-dim);
	font-size: 13px;
	line-height: 1.8;
}
.ai-empty b { color: var(--fg); }
.ai-empty .hint {
	margin-top: 14px;
	padding: 12px;
	border-radius: 10px;
	background: var(--bg);
	border: 1px dashed var(--line-strong);
	text-align: left;
	font-size: 12.5px;
	color: var(--fg-dim);
	line-height: 1.7;
}

.msg {
	display: flex;
	margin-bottom: 12px;
	gap: 8px;
}
.msg .avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 700;
	color: #fff;
	background: #7c5cff;
}
.msg.user .avatar { background: var(--accent); }
.msg .bubble {
	max-width: 82%;
	padding: 9px 12px;
	border-radius: 12px;
	background: var(--bg);
	border: 1px solid var(--line);
	font-size: 13.5px;
	line-height: 1.65;
	color: var(--fg);
	word-break: break-word;
	white-space: pre-wrap;
}
.msg.user { flex-direction: row-reverse; }
.msg.user .bubble {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
}
.msg.err .bubble {
	background: #fdecea;
	border-color: #f5c2bd;
	color: #a4271c;
}
html[data-theme="dark"] .msg.err .bubble {
	background: #3a1d1a;
	border-color: #6b2b24;
	color: #ffb4a8;
}

.msg .bubble code {
	font-family: var(--font-mono);
	font-size: 12px;
	background: rgba(0, 0, 0, .06);
	padding: 1px 4px;
	border-radius: 4px;
}
.msg.user .bubble code { background: rgba(255, 255, 255, .2); }

.ai-actions {
	display: flex;
	gap: 8px;
	margin: 4px 0 14px 36px;
	flex-wrap: wrap;
}
.ai-actions .btn { height: 32px; font-size: 12.5px; padding: 0 12px; }

/* 输入区 */
.ai-foot {
	flex: 0 0 auto;
	padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
	background: var(--bg);
	border-top: 1px solid var(--line);
}
.ai-ctx {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: var(--fg-dim);
	padding: 0 2px 6px;
}
.ai-ctx input { accent-color: var(--accent); width: 15px; height: 15px; }

.ai-row {
	display: flex;
	align-items: flex-end;
	gap: 8px;
}
#ai-input {
	flex: 1 1 auto;
	min-height: 40px;
	max-height: 120px;
	padding: 10px 12px;
	border: 1px solid var(--line-strong);
	border-radius: 12px;
	background: var(--bg-alt);
	color: var(--fg);
	font-size: 13.5px;
	font-family: inherit;
	line-height: 1.5;
	resize: none;
	outline: none;
}
#ai-input:focus { border-color: var(--accent); background: var(--bg); }

.ai-send {
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 50%;
	background: #7c5cff;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 8px rgba(124, 92, 255, .35);
}
.ai-send:active { transform: scale(.94); }
.ai-send[disabled] { opacity: .5; }
.ai-send svg.ic { width: 19px; height: 19px; }

/* 打字指示 */
.ai-typing { display: flex; gap: 4px; padding: 12px 14px; }
.ai-typing i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--fg-faint);
	animation: typing 1.1s infinite;
}
.ai-typing i:nth-child(2) { animation-delay: .18s; }
.ai-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes typing {
	0%, 60%, 100% { opacity: .25; transform: translateY(0); }
	30% { opacity: 1; transform: translateY(-3px); }
}

/* ===========================================================
   视觉美化：层次、圆角、光效与微动效（最后加载，覆盖基础样式）
   =========================================================== */

.view.active { animation: viewIn .2s ease-out; }
@keyframes viewIn {
	from { opacity: .55; transform: translateY(5px); }
	to { opacity: 1; transform: none; }
}

/* 顶栏：深海蓝渐变 + 细腻高光 */
.actionbar {
	height: 56px;
	padding: 0 8px;
	background: linear-gradient(120deg, #1d2743 0%, #273869 58%, #315085 100%);
	box-shadow: 0 4px 18px rgba(24, 39, 75, .22);
}
.actionbar::after {
	content: "";
	position: absolute;
	left: 0; right: 0; bottom: 0;
	height: 1px;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .22), transparent);
	pointer-events: none;
}
html[data-theme="dark"] .actionbar {
	background: linear-gradient(120deg, #0d1526, #17213a 60%, #1f2d4d);
}
.ab-logo {
	width: 34px;
	height: 34px;
	border-radius: 10px;
	background: linear-gradient(145deg, #7c8cff, #4c6ef5 55%, #3454d1);
	box-shadow: 0 3px 12px rgba(76, 110, 245, .45);
}
#app .ab-logo img { border-radius: 10px; }
.ab-title { font-weight: 700; letter-spacing: .4px; }
.ab-sub { color: rgba(255, 255, 255, .58); }
.ab-btn { border-radius: 12px; }
.ab-btn:active, .ab-txt:active { background: rgba(255, 255, 255, .16); }

/* 启动页英雄卡 */
.hero {
	position: relative;
	overflow: hidden;
	margin: 12px 14px 6px;
	padding: 17px 17px 18px;
	border-radius: 18px;
	color: #fff;
	background: linear-gradient(135deg, #4c6ef5 0%, #627dff 48%, #12b886 130%);
	box-shadow: 0 10px 26px rgba(76, 110, 245, .26);
}
.hero::before,
.hero::after {
	content: "";
	position: absolute;
	border-radius: 50%;
	background: rgba(255, 255, 255, .12);
	pointer-events: none;
}
.hero::before { width: 160px; height: 160px; right: -52px; top: -76px; }
.hero::after { width: 90px; height: 90px; right: 54px; bottom: -58px; background: rgba(255, 255, 255, .08); }
.hero h2 {
	position: relative;
	margin: 0;
	font-size: 17px;
	font-weight: 800;
	letter-spacing: .4px;
}
.hero p {
	position: relative;
	margin: 6px 0 0;
	font-size: 12px;
	line-height: 1.6;
	opacity: .9;
}
.hero-chips {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 12px;
}
.hero-chips span {
	padding: 4px 9px;
	border-radius: 20px;
	background: rgba(255, 255, 255, .18);
	font-size: 11px;
	letter-spacing: .2px;
	backdrop-filter: blur(4px);
}

/* 列表：卡片化 */
.list-head {
	position: sticky;
	top: 0;
	z-index: 5;
	padding: 14px 18px 10px;
	border-bottom: 0;
	background: rgba(245, 247, 251, .9);
	backdrop-filter: blur(12px);
}
html[data-theme="dark"] .list-head { background: rgba(15, 20, 32, .9); }
.list-head-right {
	padding: 2px 9px;
	border-radius: 20px;
	background: var(--accent-soft);
	color: var(--accent);
	font-weight: 700;
}
.list { padding: 0 12px 6px; }
.list-item {
	gap: 12px;
	margin: 8px 0;
	padding: 12px;
	border: 1px solid var(--line);
	border-radius: 14px;
	background: #fff;
	box-shadow: var(--shadow-1);
	transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
	animation: cardIn .24s ease-out both;
}
.list-item:hover {
	border-color: var(--accent);
	box-shadow: var(--shadow-2);
	transform: translateY(-1px);
}
.list-item:active { transform: scale(.99); }
html[data-theme="dark"] .list-item { background: var(--bg-alt); }
@keyframes cardIn {
	from { opacity: 0; transform: translateY(7px); }
	to { opacity: 1; transform: none; }
}
.li-icon.folder { background: linear-gradient(145deg, #ffc94d, #f39c09); }
.li-icon.dir { background: linear-gradient(145deg, #9aa8bd, #6d7f99); }
.li-icon { border-radius: 11px; }
.li-title { font-size: 15px; font-weight: 700; }
.li-meta span {
	padding: 2px 7px;
	border-radius: 6px;
	background: var(--bg-alt);
}
.li-arrow {
	width: 26px;
	height: 26px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--bg-alt);
}
.list-empty { padding: 46px 26px; }
.empty-ic {
	width: 76px;
	height: 76px;
	border-radius: 22px;
	background: linear-gradient(145deg, var(--accent-soft), var(--bg-alt));
	border: 1px dashed var(--line-strong);
	color: var(--accent);
}
.empty-ic svg.ic { width: 34px; height: 34px; }

/* 按钮与底栏 */
.btn {
	border-radius: 12px;
	box-shadow: var(--shadow-1);
	font-weight: 700;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary {
	border-color: transparent;
	background: linear-gradient(135deg, #5b78f7, #3d5fe4);
	box-shadow: 0 6px 16px rgba(76, 110, 245, .3);
}
.btn-run {
	border-color: transparent;
	background: linear-gradient(135deg, #22c48d, #0f9a6a);
	box-shadow: 0 6px 16px rgba(18, 168, 112, .28);
}
.btn-ghost { background: var(--bg-alt); }
.bottom-bar {
	background: rgba(238, 242, 248, .94);
	backdrop-filter: blur(12px);
}
html[data-theme="dark"] .bottom-bar { background: rgba(21, 28, 43, .94); }

/* 设置分组卡片 */
.group-title { padding: 18px 18px 8px; }
.group {
	margin: 0 12px 12px;
	border: 1px solid var(--line);
	border-radius: 14px;
	overflow: hidden;
	background: #fff;
	box-shadow: var(--shadow-1);
}
html[data-theme="dark"] .group { background: var(--bg-alt); }
.field-input:focus,
.dlg-field input:focus,
.dlg-field select:focus,
#ai-input:focus {
	box-shadow: 0 0 0 3px rgba(76, 110, 245, .16);
}
.switch i { box-shadow: inset 0 1px 3px rgba(0, 0, 0, .12); }

/* 对话框 / 菜单 / 提示 */
.dialog { border-radius: 18px; border: 1px solid var(--line); }
.dlg-title { position: relative; padding-left: 22px; }
.dlg-title::before {
	content: "";
	position: absolute;
	left: 16px; top: 19px;
	width: 3px; height: 15px;
	border-radius: 3px;
	background: var(--accent);
}
.menu-pop { border-radius: 14px; box-shadow: var(--shadow-3); }
.menu-item:active { background: var(--accent-soft); color: var(--accent); }
.toast {
	border: 1px solid rgba(255, 255, 255, .1);
	background: rgba(23, 31, 52, .94);
	backdrop-filter: blur(10px);
	box-shadow: var(--shadow-3);
}

/* 编辑器细节 */
.tabbar { height: 38px; background: var(--bg-sunken); }
.tab { font-size: 12.5px; }
.tab.on { box-shadow: inset 0 -2px 0 var(--accent); }
.toolbar { background: var(--bg-alt); }
.tb-btn { border-radius: 11px; }
.tb-btn:active { background: var(--accent-soft); color: var(--accent); }
.tb-btn.tb-ai {
	background: linear-gradient(145deg, #8b76ff, #6b4ce0);
	color: #fff;
	box-shadow: 0 3px 10px rgba(124, 92, 255, .35);
}
.statusbar { background: var(--bg-sunken); }
.ab-txt.run {
	border-radius: 20px;
	background: linear-gradient(135deg, #22c48d, #0f9a6a);
	box-shadow: 0 3px 10px rgba(18, 168, 112, .3);
}
.drawer-head { background: linear-gradient(120deg, #1d2743, #2b3c6b); }
.sheet { border-radius: 20px 20px 0 0; }
.bs-track i { background: linear-gradient(90deg, #22c48d, #6ee7b7); }
.bs-track.done i { background: linear-gradient(90deg, #0f9a6a, #6ee7b7); }

/* AI 会话气泡 */
.msg .avatar { background: linear-gradient(145deg, #8b76ff, #6b4ce0); }
.msg .bubble { box-shadow: var(--shadow-1); border-radius: 14px; }
.msg.user .bubble {
	background: linear-gradient(135deg, #5b78f7, #3d5fe4);
	border-color: transparent;
}
.ai-send {
	background: linear-gradient(145deg, #8b76ff, #6b4ce0);
	box-shadow: 0 3px 10px rgba(124, 92, 255, .35);
}

/* 降低动效偏好 */
@media (prefers-reduced-motion: reduce) {
	.view.active, .list-item, .dialog, .sheet, .menu-pop { animation: none !important; }
	* { transition-duration: .01ms !important; }
}
