/* =====================================================================
   SignageApp · 用户控制台 · 业务样式
   设备编辑器 / 模板库 / 资料面板
   ===================================================================== */

/* =========================================================
   0. 左侧导航（console 专用，不动 .topbar / .side 共享类）
   ------------------------------------------------------------
   布局：顶栏 60px + 左侧 220px 玻璃风竖排
   - 顶部：3 个功能 tab（我的设备 / 模板库 / 我的资料）
   - 下方：设备列表（仅「我的设备」tab 下显示）
   ========================================================= */
.console-sidenav {
  position: fixed;
  top: 60px;            /* 顶栏高度 */
  left: 0;
  bottom: 0;
  width: 220px;
  background: var(--panel);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow: hidden;
}
.csnav-top {
  padding: 10px 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid var(--glass-border);
}
.csnav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.csnav-item:hover {
  background: var(--hover);
  border-color: var(--glass-border);
}
.csnav-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(56,189,248,0.12));
  border-color: rgba(99,102,241,0.45);
  /* 浅色主题下白字会与浅紫背景糊在一起，改用主题主色，亮/暗主题均清晰 */
  color: var(--primary);
  font-weight: 600;
}
.csnav-ico { font-size: 16px; line-height: 1; }
.csnav-lbl { flex: 1; }
.csnav-devices {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px 10px;
  display: flex;
  flex-direction: column;
}
.csnav-devices[hidden] { display: none !important; }

/* 让 .layout 内容区右移，给新侧栏留出 220px */
.layout { padding-left: 220px; }
.layout .side { display: none; }   /* 旧设备列表侧栏已迁移到 .csnav-devices */

/* =========================================================
   模板库：工具条 + 卡片按钮 + 编辑器弹窗
   ========================================================= */
.tpl-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px 14px;
  flex-wrap: wrap;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.tpl-search {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  color: var(--text-1);
  font-size: 13px;
  min-width: 200px;
  outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.tpl-search::placeholder { color: var(--text-3); }
.tpl-search:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99, 102, 241, .14); }
.user-pane .page-head { padding-bottom: 12px; border-bottom: 1px dashed var(--line); }

.tpl-card .tpl-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-card .tpl-actions .btn { padding: 5px 10px; font-size: 12px; }
.tpl-card .tpl-badge {
  position: absolute; top: 8px; right: 8px;
  background: linear-gradient(135deg, #6366f1, #38bdf8);
  color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 10px;
  letter-spacing: 0.5px;
}

.modal-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modal-mask[hidden] { display: none; }
.modal-card {
  background: var(--panel);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  width: min(720px, 92vw);
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-card.tpl-editor { width: min(1240px, 96vw); max-height: 94vh; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--glass-border);
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-close {
  background: transparent; border: none;
  font-size: 24px; line-height: 1; color: var(--text-muted);
  cursor: pointer; padding: 0 6px;
}
.modal-close:hover { color: var(--text); }
.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--glass-border);
}

.tpl-editor .tpl-ed-section { margin-bottom: 18px; }
.tpl-editor .tpl-ed-section h4 { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--text); }
.tpl-editor .form-row label { min-width: 72px; font-size: 13px; }

/* 三栏布局：左表单 + 中右画布/iframe */
.tpl-ed-grid { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: stretch; }
.tpl-ed-form { max-height: 78vh; overflow-y: auto; padding-right: 6px; }
.tpl-ed-visual { display: flex; flex-direction: column; gap: 12px; }
.tpl-canvas-wrap { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-md); padding: 10px; }
.tpl-canvas-head { display: flex; align-items: center; padding: 0 4px 8px; }
.tpl-iframe-wrap { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-md); padding: 10px; }
.tpl-preview-frame { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius-sm); background: #000; }

/* 画布：800×450 模拟设备页（16:9） */
.tpl-canvas { position: relative; width: 100%; aspect-ratio: 16 / 9; background: linear-gradient(135deg,#0b1220,#102030); border-radius: var(--radius-sm); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06); user-select: none; }
.cv-block { position: absolute; box-sizing: border-box; transition: background-color .15s, border-color .15s; }
.cv-block-label { position: absolute; top: 2px; left: 4px; font-size: 9px; color: rgba(255,255,255,0.55); pointer-events: none; z-index: 2; letter-spacing: 0.3px; }
.cv-topbar { top: 0; left: 0; right: 0; height: 8%; background: rgba(125,180,255,0.10); border: 1px dashed rgba(125,180,255,0.45); }
.cv-main { left: 0; right: 0; background: rgba(167,139,250,0.08); border: 1px dashed rgba(167,139,250,0.45); }
.cv-footer { left: 0; right: 0; bottom: 0; background: rgba(245,158,11,0.10); border: 1px dashed rgba(245,158,11,0.55); min-height: 24px; cursor: move; }
.cv-footer[hidden] { display: none; }
.cv-tb-group { position: absolute; top: 6px; height: calc(100% - 12px); background: rgba(125,180,255,0.22); border: 1px solid rgba(125,180,255,0.55); border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #fff; cursor: ew-resize; }
.cv-tb-group span { pointer-events: none; }
.cv-tb-group .resize-handle { position: absolute; top: 0; bottom: 0; width: 4px; background: rgba(255,255,255,0.4); }
.cv-tb-group .resize-handle.left { left: -2px; cursor: w-resize; }
.cv-tb-group .resize-handle.right { right: -2px; cursor: e-resize; }
.cv-regions { position: absolute; inset: 8px; display: flex; gap: 4px; }
.cv-region { flex: 1; background: rgba(167,139,250,0.18); border: 1px dashed rgba(167,139,250,0.55); border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #fff; cursor: move; position: relative; }
.cv-region .resize-handle { position: absolute; width: 6px; height: 6px; background: rgba(255,255,255,0.6); border-radius: 50%; }
.cv-region .resize-handle.tl { top: -3px; left: -3px; cursor: nw-resize; }
.cv-region .resize-handle.tr { top: -3px; right: -3px; cursor: ne-resize; }
.cv-region .resize-handle.bl { bottom: -3px; left: -3px; cursor: sw-resize; }
.cv-region .resize-handle.br { bottom: -3px; right: -3px; cursor: se-resize; }
.cv-footer-title { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; color: rgba(255,255,255,0.85); pointer-events: none; padding: 0 8px; text-align: center; }
.cv-block.dragging { opacity: 0.6; }
.cv-block.drag-over { box-shadow: 0 0 0 2px var(--primary); }
.tpl-editor .form-row input[type="text"], .tpl-editor .form-row textarea {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 7px 10px; color: var(--text); font-size: 13px;
  flex: 1; outline: none; resize: vertical;
}
.tpl-editor .form-row input[type="text"]:focus, .tpl-editor .form-row textarea:focus {
  border-color: var(--primary);
}
.particle-row .swatch {
  width: 64px;
  height: 48px;
  border-radius: var(--radius-md);
  background: #0a0f1f;
  border: 1px solid var(--glass-border);
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: border-color 0.15s, transform 0.15s;
  overflow: hidden;
}
.particle-row .swatch:hover { transform: translateY(-1px); }
.particle-row .swatch.on {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.3);
}
.particle-row .swatch[data-pid="particle_01"] { background: radial-gradient(circle at 30% 50%, #1e3a5f 0%, #0a0f1f 80%); }
.particle-row .swatch[data-pid="particle_02"] { background: radial-gradient(circle at 70% 50%, #2d1b4e 0%, #0a0f1f 80%); }
.particle-row .swatch[data-pid="particle_03"] { background: radial-gradient(circle at 50% 30%, #0d2920 0%, #0a0f1f 80%); }
.particle-row .swatch[data-pid="particle_04"] { background: radial-gradient(circle at 50% 50%, #3a1828 0%, #0a0f1f 80%); }
.particle-row .swatch[data-pid="particle_05"] { background: linear-gradient(180deg, #0a1f1a 0%, #050a08 100%); }
.particle-preview {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.particle-preview canvas {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: #050a08;
  display: block;
}

/* 移动端（≤900px）：侧栏折叠为顶部横排 */
@media (max-width: 900px) {
  .console-sidenav {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    flex-direction: column;
  }
  .csnav-top { flex-direction: row; gap: 6px; }
  .csnav-item { flex: 1; justify-content: center; }
  .csnav-devices { display: none; }  /* 移动端下设备列表暂隐藏，kiosk 不在手机端用 */
  .layout { padding-left: 0; }
}

/* =========================================================
   1. Editor（玻璃卡）
   ========================================================= */
.editor {
  background: var(--panel);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px 24px 24px;
  box-shadow: var(--glass-shadow);
}
.editor-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}
.ed-title { font-size: 18px; font-weight: 700; background: var(--primary-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ed-sub { font-size: 12px; color: var(--text-2); margin-top: 4px; font-family: var(--font-mono); }

/* Tabs（药丸式 segmented） */
.tabs {
  display: flex; gap: 4px;
  background: var(--panel-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 18px;
  overflow-x: auto;
}
.tab {
  padding: 8px 16px;
  background: none; border: none; cursor: pointer;
  font-size: 13px; color: var(--text-2); font-weight: 500;
  border-radius: 8px;
  transition: all .15s var(--ease);
  white-space: nowrap;
}
.tab:hover { color: var(--text-1); background: var(--hover); }
.tab.active { color: #fff; background: var(--primary-grad); box-shadow: var(--shadow-primary); }
.tabpane { display: none; }
.tabpane.active { display: block; }

.pane-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; font-size: 13px; color: var(--text-2);
}
.pane-foot { margin-top: 10px; font-size: 12px; }
.pane-note {
  margin-bottom: 12px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--primary-grad-soft); color: var(--text-1);
  font-size: 13px; line-height: 1.5;
}
.editor.global-mode .inh { display: none; }
.inh {
  margin-left: auto; font-size: 12px; font-weight: 500;
  color: var(--text-2); cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.inh input { accent-color: var(--primary); }

/* =========================================================
   2. 背景 swatch / 上传
   ========================================================= */
.bg-group { margin-bottom: 18px; }
.bg-group-h { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.swatch-row { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 66px; height: 66px;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  cursor: pointer; color: #fff; font-size: 11px;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 5px; text-shadow: 0 1px 3px rgba(0,0,0,.75);
  transition: all .15s var(--ease);
  overflow: hidden; font-family: inherit;
  padding: 0; margin: 0;
}
.swatch:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: var(--shadow); }
.swatch.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary), var(--shadow-primary); }
.swatch.img { background-size: cover; background-position: center; }
.swatch.music {
  align-items: center; justify-content: center;
  width: auto; min-width: 96px; height: 38px; padding: 0 14px;
  background: var(--panel-2); color: var(--text-1);
  font-size: 12px; font-weight: 600; text-shadow: none;
  border-color: var(--line);
}
.swatch.music:hover { color: var(--primary); }
.bg-preview {
  height: 90px;
  border: 1px solid var(--line); border-radius: var(--radius);
  margin-top: 10px; background-size: cover; background-position: center;
  box-shadow: var(--shadow-sm);
}

.upload {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  border: 1px dashed var(--line); border-radius: var(--radius);
  background: var(--panel-2);
  margin-top: 10px;
  transition: all .15s var(--ease);
}
.upload:hover { border-color: var(--primary); }
.upload.drag { border-color: var(--primary); background: var(--primary-grad-soft); }
.upload input[type=file] { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; }
.upload-main { flex: 1; min-width: 0; }
.upload-pick {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius);
  background: var(--primary-grad); color: #fff;
  font-size: 13px; font-weight: 500; cursor: pointer; user-select: none;
  box-shadow: var(--shadow-primary); transition: all .2s var(--ease);
}
.upload-pick:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(99,102,241,0.42); }
.upload-meta {
  margin-top: 8px; font-size: 12px; color: var(--text-2);
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.upload-name { color: var(--text-1); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.upload-status { font-size: 12px; }
.upload-status.busy { color: var(--primary); }
.upload-status.ok { color: var(--ok); }
.upload-status.err { color: var(--err); }

/* =========================================================
   3. 顶栏可视化编辑器（拖拽 + 网格）
   ========================================================= */
.topbar-editor {
  position: relative; width: 100%; height: 120px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel-2); overflow: hidden; margin-top: 4px;
}
.topbar-editor .tb-grid { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.topbar-editor .tb-vline {
  position: absolute; top: 0; bottom: 0; width: 0;
  border-left: 1px solid var(--line); transform: translateX(-0.5px);
}
.topbar-editor .tb-hline {
  position: absolute; left: 0; right: 0; height: 0;
  border-top: 1px solid var(--line); transform: translateY(-0.5px);
}
.topbar-editor .tb-chip {
  position: absolute; top: 50%; z-index: 2;
  transform: translateY(-50%);
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--primary-grad); color: #fff;
  font-size: 14px; cursor: grab; white-space: nowrap;
  box-shadow: var(--shadow-primary); user-select: none;
  touch-action: none; border: 1px solid rgba(255,255,255,0.2);
}
.topbar-editor .tb-chip[data-block="env"] { background: linear-gradient(135deg, #10b981, #059669); }
.topbar-editor .tb-chip:active { cursor: grabbing; }
.topbar-editor .tb-chip b { font-weight: 700; }
.topbar-editor .tb-chip .tb-resize {
  position: absolute; top: 0; height: 100%; width: 18px;
  cursor: ew-resize; z-index: 3;
  background: linear-gradient(90deg, rgba(255,255,255,0.15), rgba(255,255,255,0.55));
}
.topbar-editor .tb-chip .tb-resize.left { left: 0; border-radius: var(--radius) 0 0 var(--radius); }
.topbar-editor .tb-chip .tb-resize.right { right: 0; border-radius: 0 var(--radius) var(--radius) 0; }
.topbar-editor .tb-chip:hover { box-shadow: 0 12px 32px rgba(99,102,241,0.45); }

/* 顶栏对齐控件 */
.tb-align {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.tb-align-item { display: flex; align-items: center; gap: 10px; }
.tb-align-name { font-size: 12px; color: var(--text-3); font-weight: 600; min-width: 36px; }
.seg {
  display: inline-flex; gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px; padding: 2px;
  background: var(--panel);
}
.seg button {
  padding: 4px 10px;
  font-size: 12px;
  background: none; border: none; cursor: pointer;
  color: var(--text-2);
  border-radius: 6px;
  transition: all .15s var(--ease);
}
.seg button:hover { color: var(--text-1); background: var(--hover); }
.seg button.active { background: var(--primary-grad); color: #fff; }

/* =========================================================
   4. 分屏画布 + 区域
   ========================================================= */
.split-tools {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-bottom: 10px;
}
.tpl-label { font-size: 12px; color: var(--text-3); margin-left: 8px; }
/* 工具条内的「套用模板」下拉与 .btn.small 等高对齐，避免孤立 select 撑高一行 */
.split-tools select#splitTpl {
  height: 28px; min-width: 116px;
  padding-top: 0; padding-bottom: 0; padding-left: 10px;
  font-size: 12px;
}
/* 编辑区整体：左侧为竖版平板（9:16）小画布，右侧并排放「区域设置」，
   避免横版大画布占满屏幕、把下方设置挤出视野 */
.split-editor { display: flex; align-items: flex-start; gap: 12px; }
.split-editor .region-panel { flex: 1 1 auto; min-width: 0; margin-top: 0; align-self: stretch; }
.split-editor-tip {
  flex: 1 1 auto; min-width: 0;
  align-self: stretch;
  display: flex; flex-direction: column; justify-content: center;
  padding: 14px;
  background: var(--panel-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--text-2); font-size: 12px; line-height: 1.7;
}
.split-editor-tip b { display: block; font-size: 13px; color: var(--primary); margin-bottom: 6px; }
.split-editor-tip p { margin: 0 0 6px; }
.split-editor-tip p:last-child { margin-bottom: 0; }
/* 选中区域后由「区域设置」接管右侧，提示卡自动收起（无需改业务 JS） */
.split-editor .region-panel:not([hidden]) ~ .split-editor-tip { display: none; }

/* 竖版平板：固定窄宽，9:16 比例（220×391），与真机立式屏形状一致 */
.split-canvas {
  position: relative;
  flex: 0 0 220px; width: 220px;
  aspect-ratio: 9 / 16;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  /* 9 列 × 16 行网格，与 9:16 竖版对应 */
  background-size: 11.1111% 6.25%;
  background-position: 0 0;
}
.split-canvas .region {
  position: absolute;
  border: 2px solid var(--primary);
  border-radius: 6px;
  background: var(--primary-grad-soft);
  cursor: move;
  display: flex; align-items: flex-start; justify-content: flex-end;
  padding: 4px 8px;
  font-size: 11px; font-weight: 600; color: var(--primary);
  transition: all .15s var(--ease);
}
.split-canvas .region:hover { background: var(--primary-grad-soft); border-color: var(--primary); transform: scale(1.01); }
.split-canvas .region.selected {
  background: var(--primary-grad-soft);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.split-canvas .region .r-label { background: rgba(255, 255, 255, 0.7); padding: 2px 6px; border-radius: 4px; color: var(--primary); font-size: 10px; }
.split-canvas .region .r-resize {
  position: absolute; right: -2px; bottom: -2px;
  width: 14px; height: 14px;
  background: var(--primary-grad);
  border-radius: 4px 0 4px 0;
  cursor: nwse-resize;
}
.single-src { margin-top: 12px; padding: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); }

.region-panel {
  margin-top: 12px;
  padding: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.rp-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--primary); }
.rp-actions { margin-top: 10px; display: flex; justify-content: flex-end; }

/* 来源编辑子控件 */
.src-section { margin-top: 10px; }
.src-h { font-size: 12px; font-weight: 600; color: var(--text-3); margin-bottom: 8px; }
.preview-box {
  margin-top: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  min-height: 100px;
  display: flex; align-items: center; justify-content: center;
}
.preview-box img, .preview-box video { max-width: 100%; max-height: 200px; border-radius: var(--radius-sm); }
.preview-box iframe { width: 100%; height: 200px; border: 0; border-radius: var(--radius-sm); }
.preview-empty { padding: 30px; color: var(--text-3); font-size: 12px; }

.clock-styles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.clock-style {
  padding: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: all .15s var(--ease);
}
.clock-style:hover { border-color: var(--primary); }
.clock-style.active { border-color: var(--primary); background: var(--primary-grad-soft); }
.cs-name { font-size: 12px; font-weight: 600; }
.cs-demo {
  font-family: var(--font-mono); font-weight: 700;
  color: var(--text-1);
  letter-spacing: 0.05em;
}
.cs-demo.big { font-size: 28px; }
.cs-demo.flip { font-size: 22px; padding: 6px 12px; background: #1a1d24; color: #f59e0b; border-radius: 6px; }
.cs-demo.dial {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary-grad); position: relative;
}
.cs-demo.dial::before { content: ''; position: absolute; left: 50%; top: 50%; width: 2px; height: 18px; background: #fff; transform-origin: bottom center; transform: translate(-50%, -100%) rotate(35deg); }
.cs-demo.dial::after { content: ''; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; background: #fff; border-radius: 50%; transform: translate(-50%, -50%); }

.env-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.env-check {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: all .15s var(--ease);
}
.env-check.on { border-color: var(--primary); background: var(--primary-grad-soft); }
.env-check input { display: none; }
.env-check .switch-track { width: 32px; height: 18px; }
.env-check .switch-thumb { width: 14px; height: 14px; }
.env-check .switch input:checked ~ .switch-track .switch-thumb { transform: translateX(14px); }
.ec-label { color: var(--text-1); }

/* =========================================================
   5. 模板库网格
   ========================================================= */
.user-pane { display: flex; flex-direction: column; gap: 16px; }
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.tpl-card {
  background: var(--panel);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow);
  transition: all .2s var(--ease);
  overflow: hidden;
  cursor: pointer;
}
.tpl-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.tpl-cover {
  height: 120px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #ec4899);
  position: relative;
}
.tpl-cover::after {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(45deg, rgba(255,255,255,0.1) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.1) 25%, transparent 25%);
  background-size: 20px 20px;
  opacity: 0.4;
}
.tpl-name { font-size: 15px; font-weight: 700; padding: 12px 14px 4px; }
.tpl-desc { font-size: 12px; color: var(--text-2); padding: 0 14px 12px; min-height: 36px; }
.tpl-actions { padding: 0 14px 14px; display: flex; gap: 8px; }

/* =========================================================
   6. 拖拽 + 表格小细节
   ========================================================= */
.grid tbody tr.drag-over { background: var(--primary-grad-soft); }
.grid td.drag { cursor: grab; color: var(--text-3); text-align: center; user-select: none; }
.grid td.drag:active { cursor: grabbing; }
.grid td.del { cursor: pointer; color: var(--err); text-align: center; }
.grid td.del:hover { color: var(--err); }

/* =========================================================
   7. responsive
   ========================================================= */
@media (max-width: 768px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .top-nav { margin: 0; }
  .editor { padding: 14px; }
  .tabs { overflow-x: auto; }
  .env-grid { grid-template-columns: repeat(2, 1fr); }
  /* 窄屏改为上下堆叠：画布仍保持竖版，只缩小宽度，区域设置/提示移回下方 */
  .split-editor { flex-direction: column; }
  .split-canvas { flex: 0 0 auto; width: 180px; aspect-ratio: 9 / 16; }
  .split-editor .region-panel, .split-editor-tip { width: 100%; }
}
/* =====================================================================
   模板可视化编辑器 v2（真实渲染画布 + overlay 拖拽 + 数据绑定）
   所有面板 / 控件统一使用主题变量（--text-* / --line / --panel* / --primary）
   ===================================================================== */
.modal-card.tv2 { width: min(1500px, 96vw); max-width: 96vw; height: 90vh; display: flex; flex-direction: column; }
.tv2-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tv2-chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.tv2-chk input { cursor: pointer; accent-color: var(--primary); }

.tv2-body { display: grid; grid-template-columns: 200px minmax(0, 1fr) 320px; gap: 12px; padding: 12px; flex: 1; min-height: 0; overflow: hidden; }

/* ---- 左：图层树 ---- */
.tv2-layers { overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; background: var(--panel-2); }
.tv2-layer { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; color: var(--text-1); transition: background .15s var(--ease); }
.tv2-layer:hover { background: var(--hover); }
.tv2-layer.on { background: var(--primary-grad-soft); box-shadow: inset 2px 0 0 var(--primary); }
.tv2-l-name { font-weight: 500; }
.tv2-l-sub { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- 中：真实渲染画布（模拟设备屏，保持深色） ---- */
.tv2-canvas-wrap { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tv2-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #05070c; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tv2-frame { width: 100%; height: 100%; border: 0; display: block; }
.tv2-overlay { position: absolute; inset: 0; }

/* overlay 元素框（叠加在深色画布上，保持高亮） */
.tv2-box { position: absolute; box-sizing: border-box; border: 1.5px dashed rgba(120,170,255,.55); border-radius: 4px; cursor: move; transition: border-color .15s, background .15s; }
.tv2-box:hover { border-color: rgba(120,170,255,.9); background: rgba(120,170,255,.06); }
.tv2-box.on { border: 2px solid var(--primary); background: rgba(99,102,241,.14); box-shadow: 0 0 0 1px rgba(99,102,241,.4); }
.tv2-box.tv2-footer { border-style: solid; border-color: rgba(255,190,92,.6); }
.tv2-box.tv2-footer.on { border-color: #f0a94a; background: rgba(240,169,74,.12); }
.tv2-b-label { position: absolute; top: 3px; left: 5px; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: rgba(10,14,22,.78); color: #cfe3ff; pointer-events: none; white-space: nowrap; max-width: calc(100% - 10px); overflow: hidden; text-overflow: ellipsis; }
/* 缩放手柄 */
.tv2-h { position: absolute; width: 9px; height: 9px; background: #fff; border: 1.5px solid var(--primary); border-radius: 2px; }
.tv2-h.nw { left: -5px; top: -5px; cursor: nwse-resize; }
.tv2-h.n  { left: 50%; top: -5px; margin-left: -4.5px; cursor: ns-resize; }
.tv2-h.ne { right: -5px; top: -5px; cursor: nesw-resize; }
.tv2-h.e  { right: -5px; top: 50%; margin-top: -4.5px; cursor: ew-resize; }
.tv2-h.se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.tv2-h.s  { left: 50%; bottom: -5px; margin-left: -4.5px; cursor: ns-resize; }
.tv2-h.sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.tv2-h.w  { left: -5px; top: 50%; margin-top: -4.5px; cursor: ew-resize; }

/* ---- 环境效果条 ---- */
.tv2-effects { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; background: var(--panel-2); }
.tv2-eff-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.tv2-eff-row:last-child { margin-bottom: 0; }
.tv2-eff-k { width: 32px; flex-shrink: 0; }
.tv2-sw { display: flex; gap: 6px; flex-wrap: wrap; }
.tv2-swatch { font-size: 11px; padding: 4px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel); color: var(--text-1); cursor: pointer; min-width: 34px; transition: all .15s var(--ease); }
.tv2-swatch:hover { border-color: var(--primary); color: var(--primary); }
.tv2-swatch.on { border-color: var(--primary); background: var(--primary-grad-soft); color: var(--primary); }

/* ---- 右：属性面板 ---- */
.tv2-props { overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; background: var(--panel-2); }
.tv2-empty { font-size: 12px; color: var(--text-3); text-align: center; padding: 30px 10px; }
.tv2-h4 { font-size: 13px; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); color: var(--text-1); }
.tv2-row { margin-bottom: 10px; }
.tv2-row > label { display: block; font-size: 11px; color: var(--text-2); margin-bottom: 4px; }
.tv2-ctl { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tv2-ctl input[type="number"] { width: 74px; }
.tv2-ctl input[type="text"], .tv2-ctl select { flex: 1; min-width: 90px; }
.tv2-subcard { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 8px; margin-bottom: 8px; }
.tv2-bind { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.tv2-bind input { width: 100%; }
.tv2-varpick { width: 100%; font-size: 11px; }

/* ---- 表单控件主题样式（输入框 / 下拉 / 数字 / 文本） ---- */
.tv2-props input[type="text"],
.tv2-props input[type="number"],
.tv2-props select,
.tv2-bind input,
.tv2-varpick,
.tv2-name input,
.tv2-tools select.tv2-select {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text-1);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
.tv2-props input:hover,
.tv2-props select:hover,
.tv2-bind input:hover,
.tv2-varpick:hover,
.tv2-name input:hover,
.tv2-tools select.tv2-select:hover { border-color: var(--text-3); }
.tv2-props input:focus,
.tv2-props select:focus,
.tv2-bind input:focus,
.tv2-varpick:focus,
.tv2-name input:focus,
.tv2-tools select.tv2-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.14);
}
.tv2-props input::placeholder,
.tv2-name input::placeholder { color: var(--text-3); }
.tv2-varpick { color: var(--text-2); }

/* ---- 底部 ---- */
.tv2-name { display: flex; gap: 8px; flex: 1; }
.tv2-name input { flex: 1; }
.tv2-name input#tv2Name { max-width: 240px; }

@media (max-width: 1200px) {
  .tv2-body { grid-template-columns: 160px minmax(0, 1fr) 260px; }
}

/* =========================================================
   全控制台统一版式：分组卡片 / 开关 / 按钮 / 说明文字
   （设备控制 tab 与其余配置页共用同一套组件）
   ========================================================= */
.pane-stack {
  display: flex; flex-direction: column; gap: 14px;
  padding-bottom: 8px;
}

/* 顶部设备状态条 */
.ctrl-status {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--primary-grad-soft);
  font-size: 13px; color: var(--text-1);
}
.ctrl-status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); flex-shrink: 0; }
.ctrl-status .dot.on { background: #10b981; box-shadow: 0 0 0 4px rgba(16, 185, 129, .18); }
.ctrl-status .dot.off { background: var(--text-3); }
.ctrl-status b { font-weight: 600; }
.ctrl-status-state { font-size: 12px; color: var(--text-2); }
.ctrl-status-state.on { color: #059669; font-weight: 600; }
.ctrl-status-state.off { color: var(--text-3); }
.ctrl-status-meta {
  margin-left: auto; font-size: 12px; color: var(--text-2);
  font-family: var(--font-mono, ui-monospace, monospace);
}
.ctrl-global-tip {
  padding: 10px 14px; border: 1px solid rgba(245, 158, 11, .35);
  border-radius: var(--radius); background: rgba(245, 158, 11, .10);
  color: var(--text-1); font-size: 13px; line-height: 1.6;
}

/* 分组卡片 */
.pane-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel-solid); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.pane-card-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.pane-card-hd > div:first-child { flex: 1 1 220px; min-width: 0; }
.pane-card-hd h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-1); display: block; }
.pane-card-hd p { margin: 3px 0 0; font-size: 12px; color: var(--text-2); line-height: 1.5; }
.pane-card-hd .inh { flex-shrink: 0; margin-left: auto; }
.pane-card-hd .btn.small { flex-shrink: 0; }
.pane-tag {
  flex-shrink: 0; font-size: 11px; padding: 3px 10px; border-radius: 999px;
  color: var(--primary); background: var(--primary-grad-soft);
  border: 1px solid var(--line); white-space: nowrap;
}
.pane-card-bd { padding: 12px 16px 16px; }
.pane-stack.is-global .pane-card { opacity: .62; }

/* 按钮行 / 说明文字 */
.pane-btns { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.pane-btns-gap { margin-top: 14px; }
.pane-btns .btn.small { min-height: 32px; }
.pane-btns .btn.danger { color: var(--err); border-color: rgba(239, 68, 68, .35); }
.pane-btns .btn.danger:hover { background: rgba(239, 68, 68, .08); border-color: var(--err); }
.pane-hint { margin-top: 10px; font-size: 12px; line-height: 1.7; color: var(--text-2); }
/* 多页面入口行：复用开关行版式，右侧为标准 .btn；仅在单屏设置区常驻 */
.pane-action-row { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.pane-action-row > .btn { flex-shrink: 0; white-space: nowrap; }

/* 开关行（补齐 switch-track 后可见） */
.pane-toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.pane-toggle-row:last-of-type { border-bottom: 0; }
.pane-toggle-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pane-toggle-label b { font-size: 13px; font-weight: 600; color: var(--text-1); }
.pane-toggle-label .muted { font-size: 12px; line-height: 1.4; }
.tabpane .switch { flex-shrink: 0; gap: 8px; }
.tabpane .switch-track {
  background: rgba(15, 23, 42, .18); border-color: rgba(15, 23, 42, .22);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .10);
}
.tabpane .switch-thumb { box-shadow: 0 1px 3px rgba(15, 23, 42, .30); }
[data-theme="dark"] .tabpane .switch-track {
  background: rgba(148, 163, 184, .30); border-color: rgba(148, 163, 184, .34);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .30);
}
.tabpane .switch-text { min-width: 30px; text-align: right; }
.tabpane .switch input:disabled ~ .switch-track { opacity: .5; }
.tabpane .switch input:disabled ~ .switch-text { opacity: .6; }

/* PIN 输入行（避免标签折行） */
.pane-pin-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0 0; }
.pane-pin-row label { font-size: 13px; font-weight: 600; color: var(--text-1); white-space: nowrap; min-width: 130px; }
.pane-pin-row input[type="password"] {
  flex: 0 1 220px; min-width: 140px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text-1);
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.pane-pin-row input[type="password"]:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99, 102, 241, .14); }
.pane-pin-row input[type="password"]:disabled { opacity: .55; }
.pane-pin-row .muted { font-size: 12px; }

/* 定时规则列表 */
.power-rules { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.power-rules:empty { display: none; }
.power-rules-empty {
  padding: 16px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--text-2); font-size: 13px; line-height: 1.6;
}
.power-rule {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel-2); padding: 10px 12px;
}
.power-rule-hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.power-rule-idx { font-size: 12px; font-weight: 600; color: var(--text-3); min-width: 44px; }
.power-rule select,
.power-rule input[type="time"],
.power-rule input[type="datetime-local"] {
  height: 32px; padding: 5px 8px; font-size: 12px;
  background: var(--panel-solid); border: 1px solid var(--line); color: var(--text-1);
  border-radius: var(--radius-sm); outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.power-rule select:hover,
.power-rule input:hover { border-color: var(--text-3); }
.power-rule select:focus,
.power-rule input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99, 102, 241, .14); }
.power-rule .pr-action { min-width: 100px; }
.power-rule .pr-kind { min-width: 94px; }
.power-rule .pr-time { width: 108px; }
.power-rule .pr-datetime { width: 198px; }
.power-rule .pr-enabled-label {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text-2); white-space: nowrap; cursor: pointer;
}
.power-rule .pr-enabled { width: 14px; height: 14px; margin: 0; accent-color: var(--primary); }
.power-rule .pr-del {
  height: 32px; padding: 4px 10px; color: var(--err);
  border-color: rgba(239, 68, 68, .35); background: transparent;
}
.power-rule .pr-del:hover { background: rgba(239, 68, 68, .08); border-color: var(--err); }
.power-rule-days {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line);
}
.power-rule-days .pr-day-label { font-size: 12px; color: var(--text-3); margin-right: 2px; }
.pr-day-chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; padding: 3px 8px; border-radius: 999px;
  color: var(--text-2); background: var(--panel-solid);
  border: 1px solid var(--line); cursor: pointer; user-select: none;
  transition: all .15s var(--ease);
}
.pr-day-chip:hover { border-color: var(--primary); }
.pr-day-chip.on { color: var(--primary); background: var(--primary-grad-soft); border-color: var(--primary); font-weight: 600; }
.pr-day-chip input { width: 12px; height: 12px; margin: 0; accent-color: var(--primary); }
.pr-days-note { font-size: 12px; color: var(--text-3); margin-left: 4px; }

/* =========================================================
   其余配置页沿用同一套视觉语言（表单 / 组件 / 说明）
   ========================================================= */
/* 表单标签不折行；开关型 label 不受固定宽度影响 */
.tabpane .form-row > label:not(.switch),
.user-pane .form-row > label:not(.switch) {
  width: 120px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
}
/* 卡片内首个子元素不留顶部空隙，末个子元素不留底部空隙 */
.pane-card-bd > :first-child { margin-top: 0; }
.pane-card-bd > :last-child { margin-bottom: 0; }
/* 说明文字统一（含老页面的 .pane-foot） */
.tabpane .pane-foot { margin-top: 10px; font-size: 12px; line-height: 1.7; color: var(--text-2); }
.tabpane .pane-hint { margin-top: 10px; font-size: 12px; line-height: 1.7; color: var(--text-2); }
/* 卡片内的组件间距与边框统一 */
.pane-card-bd .bg-group { margin-bottom: 16px; }
.pane-card-bd .bg-group-h { color: var(--text-2); letter-spacing: 0; text-transform: none; }
.pane-card-bd .bg-preview,
.pane-card-bd .tb-align,
.pane-card-bd .upload,
.pane-card-bd .single-src,
.pane-card-bd .region-panel { border-color: var(--line); }
.pane-card-bd .split-tools,
.pane-card-bd .rp-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.pane-card-bd .rp-actions { justify-content: flex-end; }
.pane-card-bd .split-tools .muted { font-size: 12px; line-height: 1.6; }
/* 卡片内表格：窄屏可横向滚动，避免撑破卡片 */
.pane-card-bd .grid { width: 100%; border-color: var(--line); }
.pane-card-bd .pane-note { margin-bottom: 12px; }
/* 标题栏里的 tag 与继承开关在窄屏换行时不重叠 */
@media (max-width: 900px) {
  .ctrl-status-meta { margin-left: 0; }
  .pane-pin-row label { min-width: 0; }
  .power-rule .pr-enabled { margin-left: 0; }
  .tabpane .form-row > label:not(.switch),
  .user-pane .form-row > label:not(.switch) { width: 100px; }
  .pane-card-hd .inh { margin-left: 0; }
}

/* =========================================================
   我的资产库：左侧按类型分文件夹的树 + 右侧卡片网格
   全部颜色走主题变量，亮/暗主题均可读
   ========================================================= */
.csnav-assets {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px 10px;
  display: flex;
  flex-direction: column;
}
.csnav-assets[hidden] { display: none !important; }
.asset-tree-summary {
  font-size: 11px; color: var(--text-2);
  padding: 2px 6px 8px; line-height: 1.6;
}
.asset-tree { display: flex; flex-direction: column; gap: 5px; }
.asset-folder {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  overflow: hidden;
}
.asset-folder > .af-head {
  display: flex; align-items: center; gap: 7px;
  width: 100%; padding: 8px 9px;
  background: transparent; border: 0;
  color: var(--text-1); font-size: 13px;
  cursor: pointer; text-align: left;
  transition: background .15s var(--ease);
}
.asset-folder > .af-head:hover { background: var(--hover); }
.asset-folder.active > .af-head {
  background: var(--primary-grad-soft);
  color: var(--primary); font-weight: 600;
}
.af-ico { font-size: 14px; line-height: 1; }
.af-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-caret { font-size: 10px; color: var(--text-3); transition: transform .15s var(--ease); }
.asset-folder.open .af-caret { transform: rotate(90deg); }
.af-count {
  font-size: 10px; color: var(--text-2);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 1px 6px; flex-shrink: 0;
}
.af-files { display: none; flex-direction: column; gap: 2px; padding: 2px 6px 8px; }
.asset-folder.open .af-files { display: flex; }
.af-file {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 5px 8px;
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--text-2);
  font-size: 11.5px; cursor: pointer; text-align: left;
}
.af-file:hover { background: var(--hover); color: var(--text-1); }
.af-file.selected {
  background: var(--primary-grad-soft);
  color: var(--primary); border-color: var(--line);
}
.af-file .af-fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-lock { opacity: .75; flex-shrink: 0; }
.af-empty { font-size: 11px; color: var(--text-3); padding: 4px 10px 9px; }

/* 资产上传：复用全局 .upload / .upload-pick，与背景图、背景音乐的选择文件按钮保持同款 */
.asset-upload-row { margin-top: 0; gap: 12px; flex-wrap: wrap; }
.asset-upload-row .upload-main { flex: 1; min-width: 200px; }
.asset-upload-row .upload-meta { margin-top: 8px; }
.asset-upload-row .upload-name { max-width: 100%; }
.asset-upload-row .btn.small { flex-shrink: 0; min-height: 32px; }
.asset-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.asset-filter .btn.active {
  background: var(--primary-grad-soft);
  border-color: var(--primary); color: var(--primary);
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.asset-empty { grid-column: 1 / -1; text-align: center; padding: 34px 12px; color: var(--text-2); font-size: 13px; }
.asset-tile {
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel-2); overflow: hidden;
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
}
.asset-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary); }
.asset-tile.selected { border-color: var(--primary); box-shadow: var(--shadow-primary); }
.asset-tile-thumb {
  aspect-ratio: 16 / 10;
  background: var(--primary-grad-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; overflow: hidden; cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.asset-tile-thumb img { width: 100%; height: 100%; object-fit: cover; }
.asset-tile-meta { padding: 9px 11px 5px; }
.asset-tile-name {
  font-size: 12.5px; font-weight: 600; color: var(--text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.asset-tile-sub {
  margin-top: 3px; font-size: 11px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.asset-tile-badge {
  display: inline-block; margin-top: 6px; padding: 2px 7px;
  font-size: 10px; color: var(--text-2);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
.asset-tile-ops { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 10px 10px; }
.asset-tile-ops .btn { flex: 1; min-width: 58px; }
.asset-tile-ops .btn.danger { color: var(--err); border-color: rgba(239, 68, 68, .35); }
.asset-tile-ops .btn.danger:hover { background: rgba(239, 68, 68, .08); border-color: var(--err); }

.asset-preview {
  margin-bottom: 14px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel);
}
.asset-preview[hidden] { display: none !important; }
.asset-preview-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-2); margin-bottom: 10px;
}
.asset-preview-head b { color: var(--text-1); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-preview-head .btn { margin-left: auto; }
.asset-preview-body { display: flex; justify-content: center; background: var(--panel-2); border-radius: var(--radius-sm); padding: 10px; }
.asset-preview-body img, .asset-preview-body video { max-width: 100%; max-height: 320px; border-radius: 6px; }
.asset-preview-body audio { width: 100%; }
.asset-preview-body .ap-placeholder { font-size: 44px; padding: 20px; }

/* ---------- 资产空间配额：使用率 + 颜色分级 + 各类型占比 ---------- */
.quota-overview { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.quota-numbers { display: flex; align-items: baseline; gap: 6px; }
.quota-used { font-size: 26px; font-weight: 700; line-height: 1.1; color: var(--text-1); }
.quota-total { font-size: 13px; color: var(--text-2); }
.quota-side { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.quota-percent { font-size: 16px; font-weight: 700; }
.quota-percent.lvl-ok, .pane-tag.lvl-ok { color: var(--ok); }
.quota-percent.lvl-warn, .pane-tag.lvl-warn { color: var(--warn); }
.quota-percent.lvl-danger, .quota-percent.lvl-over, .pane-tag.lvl-danger, .pane-tag.lvl-over { color: var(--err); }
.pane-tag.lvl-ok { border-color: rgba(16,185,129,.35); background: rgba(16,185,129,.10); }
.pane-tag.lvl-warn { border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.10); }
.pane-tag.lvl-danger, .pane-tag.lvl-over { border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.10); }

.quota-bar {
  position: relative; height: 14px; margin-top: 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel-2); overflow: hidden;
}
.quota-bar-fill { height: 100%; width: 0; border-radius: 999px; background: var(--ok); transition: width .45s var(--ease), background .25s; }
.quota-bar-fill.lvl-ok { background: linear-gradient(90deg, #34d399, #10b981); }
.quota-bar-fill.lvl-warn { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.quota-bar-fill.lvl-danger { background: linear-gradient(90deg, #fb7185, #ef4444); }
.quota-bar-fill.lvl-over { background: linear-gradient(90deg, #ef4444, #b91c1c); }
.quota-bar-mark { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--panel); opacity: .8; pointer-events: none; }
.quota-scale { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 11px; color: var(--text-2); }

.quota-types-hd { display: flex; align-items: baseline; gap: 8px; margin: 16px 0 8px; font-size: 13px; font-weight: 600; color: var(--text-1); }
.quota-types-hd .muted { font-weight: 400; font-size: 11px; }
.quota-stack { display: flex; height: 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.quota-stack-seg { height: 100%; transition: width .4s var(--ease); }
.quota-stack.is-empty { background: repeating-linear-gradient(45deg, var(--panel-2), var(--panel-2) 6px, var(--panel) 6px, var(--panel) 12px); }
.quota-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quota-legend .btn { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.quota-legend .btn.active { border-color: var(--primary); color: var(--primary); background: var(--primary-grad-soft); }
.quota-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.pane-hint.quota-hint-warn { color: var(--err); }

@media (max-width: 768px) {
  .csnav-assets { display: none; }
  .asset-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .quota-scale span:nth-child(2) { display: none; }
  .quota-used { font-size: 22px; }
}

/* =========================================================
   单屏模式：多页面轮播管理
   ========================================================= */
.pane-card-hd-ops { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.single-page-list { display: flex; flex-direction: column; gap: 6px; }
.single-page-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel-2); cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.single-page-row:hover { border-color: var(--primary); }
.single-page-row.active { border-color: var(--primary); background: var(--primary-grad-soft); }
.sp-idx {
  flex: 0 0 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--primary);
  background: var(--primary-grad-soft); border: 1px solid var(--line);
}
.single-page-row.active .sp-idx { color: #fff; background: var(--primary-grad); border-color: transparent; }
.sp-name { font-size: 13px; font-weight: 600; color: var(--text-1); min-width: 90px; }
.sp-mod { font-size: 12px; color: var(--text-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-ops { display: flex; gap: 5px; flex-shrink: 0; }
.sp-ops .btn.small { padding: 4px 9px; font-size: 12px; }
.single-page-opts {
  margin-top: 14px; padding: 12px 14px 8px;
  border: 1px dashed var(--line); border-radius: var(--radius);
  background: var(--panel);
}
.spo-title { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 12px; letter-spacing: .02em; }
.single-page-opts .form-row > label { width: 100px; }
.single-page-opts input[type="number"] { max-width: 140px; }
@media (max-width: 768px) {
  .single-page-row { flex-wrap: wrap; }
  .sp-mod { flex-basis: 100%; }
}

/* 底部信息栏「显示整栏」：与设备控制页一致的开关行 + 只读态 */
.pane-toggle-row.is-disabled .pane-toggle-label { opacity: .6; }
.pane-toggle-row.is-disabled .switch { cursor: not-allowed; }
/* 左侧固定导航 220px，页脚在主内容区内居中 */
#view-user-shell > .app-footer { padding-left: calc(220px + 24px); }
@media (max-width: 900px) {
  #view-user-shell > .app-footer { padding-left: 12px; }
}
