/* ============ Aether ============ */
:root {
  --bg: #0b0c10;
  --panel: #14161d;
  --panel-2: #191c25;
  --panel-3: #212531;
  --border: #292e3b;
  --border-light: #394054;
  --text: #e9ebf2;
  --muted: #949aad;
  --dim: #666e82;
  --accent: #7c5cff;
  --accent-2: #4d9fff;
  --blue: #4d9fff;
  --purple: #a56cff;
  --pink: #f0629c;
  --teal: #2fd0b8;
  --amber: #f2ad4c;
  --ok: #3ed598;
  --err: #ff6b73;
  --radius: 12px;
  --shadow: 0 14px 40px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
button:disabled { cursor: not-allowed; opacity: .45; }
svg { display: block; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #33394a; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #454d63; }

.app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- Topbar ---------- */
.topbar {
  height: 56px;
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  background: linear-gradient(180deg, #161922, #11131a);
  border-bottom: 1px solid var(--border);
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 9px; min-width: 210px; }
.brand-mark { width: 28px; height: 28px; color: var(--accent); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-name { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.brand-tag {
  font-size: 9px; font-weight: 700; letter-spacing: 1.2px;
  color: var(--accent-2); background: rgba(77, 159, 255, .12);
  border: 1px solid rgba(77, 159, 255, .28);
  padding: 3px 6px; border-radius: 5px;
}

.topbar-center, .topbar-right { display: flex; align-items: center; gap: 6px; }
.topbar-center { flex: 1; }
.topbar-right { margin-left: auto; }
.tsep { width: 1px; height: 20px; background: var(--border-light); margin: 0 6px; }

.tbtn {
  height: 32px; padding: 0 11px;
  display: inline-flex; align-items: center; gap: 7px;
  color: #c8cddd; background: #1c202b;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 12.5px; white-space: nowrap;
  transition: .16s ease;
}
.tbtn svg { width: 15px; height: 15px; }
.tbtn:hover { background: #252a37; color: #fff; border-color: var(--border-light); }
.tbtn.primary {
  background: linear-gradient(135deg, #7c5cff, #5a6cff);
  border-color: transparent; color: #fff; font-weight: 600;
  box-shadow: 0 3px 12px rgba(124, 92, 255, .28);
}
.tbtn.primary:hover { filter: brightness(1.12); }
.tbtn.icon { width: 32px; padding: 0; justify-content: center; }
.tbtn.api-entry {
  background: linear-gradient(135deg, #7c5cff, #5a6cff);
  border-color: transparent; color: #fff; font-weight: 600;
  box-shadow: 0 3px 12px rgba(124, 92, 255, .3);
}
.tbtn.api-entry:hover { filter: brightness(1.12); color: #fff; }
.tbtn.api-entry.pending { background: linear-gradient(135deg, #ff9f43, #ff6b73); box-shadow: 0 3px 12px rgba(255,107,115,.3); }
.points-pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 12px; border-radius: 16px;
  background: rgba(124, 92, 255, .12); border: 1px solid rgba(124, 92, 255, .3);
  color: #c9b8ff; font-size: 12.5px; font-weight: 600;
  white-space: nowrap; cursor: default;
}
.points-pill svg { width: 14px; height: 14px; color: #ffce5c; }
.points-pill em { font-style: normal; color: #ffd66b; font-size: 14px; }
.tbtn:active { transform: translateY(1px); }

/* ---------- Workspace ---------- */
.workspace { flex: 1; display: flex; min-height: 0; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 236px; flex: 0 0 236px;
  background: linear-gradient(180deg, #141721, #11131a);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 16px 12px 12px;
  z-index: 20;
}
.side-head { padding: 0 6px 12px; }
.side-title { font-size: 13px; font-weight: 700; letter-spacing: .3px; }
.side-sub { color: var(--dim); font-size: 11px; margin-top: 3px; }

.node-list { display: flex; flex-direction: column; gap: 6px; }
.node-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 9px; border-radius: 10px;
  background: #1a1d27; border: 1px solid transparent;
  text-align: left; transition: .15s ease;
}
.node-item:hover { background: #222635; border-color: var(--border-light); transform: translateX(2px); }
.ni-icon {
  width: 32px; height: 32px; flex: 0 0 32px;
  border-radius: 9px; display: grid; place-items: center;
}
.ni-icon svg { width: 17px; height: 17px; }
.node-item[data-color="blue"] .ni-icon { color: var(--blue); background: rgba(77,159,255,.14); }
.node-item[data-color="purple"] .ni-icon { color: var(--purple); background: rgba(165,108,255,.14); }
.node-item[data-color="pink"] .ni-icon { color: var(--pink); background: rgba(240,98,156,.14); }
.node-item[data-color="teal"] .ni-icon { color: var(--teal); background: rgba(47,208,184,.14); }
.node-item[data-color="amber"] .ni-icon { color: var(--amber); background: rgba(242,173,76,.14); }
.ni-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ni-text strong { font-size: 12.5px; font-weight: 600; }
.ni-text small { font-size: 10.5px; color: var(--dim); white-space: nowrap; }
.ni-plus { margin-left: auto; color: var(--dim); font-size: 17px; line-height: 1; }
.node-item:hover .ni-plus { color: var(--accent-2); }

.side-guide {
  margin-top: auto; padding: 12px 8px 4px;
  border-top: 1px solid var(--border);
}
.guide-title { font-size: 11px; color: var(--dim); margin-bottom: 9px; letter-spacing: .5px; }
.guide-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; color: #9ca3b6; font-size: 11px; }
.guide-row kbd {
  min-width: 38px; text-align: center;
  padding: 2px 5px; border-radius: 5px;
  background: #202430; border: 1px solid var(--border-light);
  font-size: 10px; color: #c0c7d8; font-family: inherit;
}

.side-status, .side-api-entry {
  width: 100%; margin-top: 10px; padding: 10px 9px;
  display: flex; align-items: center; gap: 8px; text-align: left;
  border-radius: 8px; background: #191c25;
  border: 1px solid var(--border);
  font-size: 11.5px; color: var(--muted);
}
.side-api-entry { cursor: pointer; transition: .16s; }
.side-api-entry:hover { background: #232735; border-color: #5a4bd6; color: #fff; }
.side-api-entry svg { width: 14px; height: 14px; margin-left: auto; color: #7c6cff; flex: 0 0 14px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #ff9f43; flex: 0 0 7px; box-shadow: 0 0 8px rgba(255,159,67,.5); }
.side-status.ready .status-dot, .side-api-entry.ready .status-dot { background: var(--ok); box-shadow: 0 0 8px rgba(62,213,152,.6); }
.side-status.ready .status-text, .side-api-entry.ready .status-text { color: #b9e8d4; }

/* ---------- Canvas ---------- */
.canvas-area { flex: 1; position: relative; min-width: 0; overflow: hidden; }
.canvas-viewport {
  position: absolute; inset: 0;
  background-color: var(--bg);
  background-image: radial-gradient(circle, rgba(190, 200, 230, .16) 1px, transparent 1.2px);
  background-size: 24px 24px;
  cursor: default;
  overflow: hidden;
}
.canvas-viewport.panning { cursor: grabbing; }
.canvas-viewport.linking { cursor: crosshair; }
/* 拖文件进画布时的整屏高亮提示 */
.canvas-viewport.file-drop-active::after {
  content: '松开以导入 · 图片 / 视频 / 音频';
  position: absolute; inset: 12px; z-index: 50;
  display: grid; place-items: center;
  border: 2px dashed var(--accent, #8b7bff);
  border-radius: 14px;
  background: rgba(90, 76, 190, .10);
  color: #d9d3ff; font-size: 15px; font-weight: 600; letter-spacing: .3px;
  pointer-events: none;
}
.canvas-viewport.file-drop-active {
  box-shadow: inset 0 0 0 2px rgba(139, 123, 255, .35);
}
/* 参考行命中高亮 */
.vref-line.drag-hover {
  background: rgba(139, 123, 255, .16);
  border-radius: 7px;
  outline: 1px dashed var(--accent, #8b7bff);
}
.world { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }

.edge-layer {
  position: absolute; left: 0; top: 0;
  width: 1px; height: 1px; overflow: visible;
  pointer-events: none; z-index: 1;
}
.edge-path {
  fill: none; stroke: #4d5568; stroke-width: 2.5;
  pointer-events: stroke; cursor: pointer;
  transition: stroke .15s;
}
.edge-path:hover { stroke: #8b94ad; stroke-width: 3.5; }
.edge-path.selected { stroke: var(--accent-2); filter: drop-shadow(0 0 5px rgba(77,159,255,.6)); }
.edge-temp { fill: none; stroke: var(--accent-2); stroke-width: 2.5; stroke-dasharray: 6 5; }

/* ---------- Node card ---------- */
.node {
  position: absolute; z-index: 2;
  width: 320px;
  background: linear-gradient(180deg, #1c1f2a 0%, #171921 100%);
  border: 1px solid #2f3545;
  border-radius: 13px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .48), 0 1px 0 rgba(255,255,255,.03) inset;
  color: var(--text);
  display: flex; flex-direction: column;
  transition: border-color .15s, box-shadow .15s;
}
.node.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(124,92,255,.28), 0 16px 44px rgba(0,0,0,.6);
  z-index: 4;
}
.node.running { border-color: var(--amber); }
.node[data-color="blue"] { --nc: var(--blue); --nb: rgba(77,159,255,.15); }
.node[data-color="purple"] { --nc: var(--purple); --nb: rgba(165,108,255,.15); }
.node[data-color="pink"] { --nc: var(--pink); --nb: rgba(240,98,156,.15); }
.node[data-color="teal"] { --nc: var(--teal); --nb: rgba(47,208,184,.15); }
.node[data-color="amber"] { --nc: var(--amber); --nb: rgba(242,173,76,.15); }

.node-head {
  height: 44px; flex: 0 0 44px;
  display: flex; align-items: center; gap: 9px;
  padding: 0 11px;
  border-bottom: 1px solid #2a2f3c;
  border-radius: 13px 13px 0 0;
  cursor: grab;
}
.node-head:active { cursor: grabbing; }
.node-head::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 44px;
  border-radius: 13px 13px 0 0; background: var(--nb); opacity: .55; pointer-events: none;
}
.node-icon {
  width: 25px; height: 25px; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--nb); color: var(--nc);
  position: relative; z-index: 1;
}
.node-icon svg { width: 15px; height: 15px; }
.node-title { font-weight: 650; font-size: 12.5px; position: relative; z-index: 1; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-dim { position: relative; z-index: 1; flex-shrink: 0; font-size: 10px; color: var(--dim); padding: 1px 6px; border-radius: 5px; background: rgba(255,255,255,.05); font-variant-numeric: tabular-nums; }
.node-subtitle { font-size: 10px; color: var(--dim); position: relative; z-index: 1; }
.node-head-actions { margin-left: auto; display: flex; gap: 3px; position: relative; z-index: 1; }
.nh-btn {
  width: 24px; height: 24px; border-radius: 6px;
  display: grid; place-items: center; color: var(--dim);
  transition: .15s;
}
.nh-btn svg { width: 13px; height: 13px; }
.nh-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.nh-btn.danger:hover { background: rgba(255,107,115,.15); color: var(--err); }
.nh-btn.run { color: var(--nc); }
.nh-btn.run:hover { background: var(--nb); color: var(--nc); }
.nh-btn.edit.active { color: var(--nc); background: var(--nb); }

.node-body { padding: 11px; display: flex; flex-direction: column; gap: 10px; }
.node-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; border-top: 1px solid #2a2f3c;
  border-radius: 0 0 13px 13px;
  background: rgba(0,0,0,.1);
}
.status-line { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--dim); min-width: 0; flex: 1; }
.status-line .st-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-line.ok { color: var(--ok); }
.status-line.err { color: var(--err); }
.status-line.loading { color: var(--amber); }
.spinner {
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid rgba(242,173,76,.25); border-top-color: var(--amber);
  animation: spin .7s linear infinite; flex: 0 0 11px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Ports ---------- */
.port {
  position: absolute; width: 14px; height: 14px;
  border-radius: 50%; background: #0e1016;
  border: 2px solid var(--pc, #7d8699);
  z-index: 6; cursor: crosshair;
  transition: transform .12s, box-shadow .12s;
}
.port.in { left: -8px; }
.port.out { right: -8px; }
.port:hover { transform: scale(1.4); box-shadow: 0 0 10px var(--pc, #7d8699); }
.port.connected::after {
  content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--pc, #7d8699);
}
.port[data-type="text"] { --pc: var(--blue); }
.port[data-type="image"] { --pc: var(--purple); }
.port[data-type="video"] { --pc: var(--pink); }
.port[data-type="audio"] { --pc: var(--teal); }
.port[data-type="script"] { --pc: var(--amber); }

.port-label {
  position: absolute; font-size: 9px; color: var(--dim);
  pointer-events: none; white-space: nowrap;
}
.port-label.pl-in { left: 12px; }
.port-label.pl-out { right: 12px; }

/* ---------- Node fields ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10.5px; color: #9aa2b5; font-weight: 600; letter-spacing: .2px;
}
.field-label .lite { color: var(--dim); font-weight: 400; }
.n-input, .n-select, .n-textarea {
  width: 100%; background: #12141c;
  border: 1px solid #2d3342; border-radius: 8px;
  padding: 8px 9px; font-size: 12px; line-height: 1.5;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.n-input:focus, .n-select:focus, .n-textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 2px rgba(124,92,255,.16);
}
.n-textarea { resize: vertical; min-height: 72px; max-height: 340px; }
.n-select { appearance: none; cursor: pointer; padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23949aad' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center; background-size: 13px;
}
.n-row { display: flex; gap: 8px; }
.n-row > * { flex: 1; min-width: 0; }
.n-check {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; color: #9aa2b5; cursor: pointer;
  padding: 2px 1px;
}
.n-check input {
  appearance: none; width: 14px; height: 14px; border-radius: 4px;
  border: 1px solid #3a4256; background: #12141c; cursor: pointer;
  display: grid; place-items: center; flex: 0 0 14px;
}
.n-check input:checked { background: var(--accent); border-color: var(--accent); }
.n-check input:checked::after { content: ""; width: 6px; height: 3px; border-left: 1.6px solid #fff; border-bottom: 1.6px solid #fff; transform: rotate(-45deg) translate(1px,-1px); }
.dropzone.dragover { border-color: var(--nc) !important; background: var(--nb) !important; }

.n-btn {
  height: 28px; padding: 0 10px; border-radius: 7px;
  background: #242938; border: 1px solid var(--border-light);
  color: #c9cfdf; font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  transition: .15s;
}
.n-btn:hover { background: #2e3446; color: #fff; }
.n-btn svg { width: 12px; height: 12px; }
.n-btn.accent { background: var(--nb); border-color: color-mix(in srgb, var(--nc) 45%, transparent); color: var(--nc); }
.n-btn.accent:hover { background: color-mix(in srgb, var(--nc) 24%, transparent); }
.n-btn.sm { height: 24px; padding: 0 8px; font-size: 10.5px; }
.n-btn:disabled { opacity: .4; }

.gen-btn {
  height: 34px; width: 100%; border-radius: 8px;
  background: linear-gradient(135deg, var(--nc), color-mix(in srgb, var(--nc) 55%, #5a6cff));
  color: #0e1016; font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  box-shadow: 0 4px 14px var(--nb);
  transition: .15s;
}
.gen-btn svg { width: 14px; height: 14px; }
.gen-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.gen-btn:active { transform: translateY(0); }

.dropzone {
  min-height: 62px; border-radius: 9px;
  border: 1.5px dashed #333a4b; background: #12141b;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--dim); font-size: 11px; cursor: pointer;
  transition: .15s; position: relative; overflow: hidden;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--nc); color: var(--nc); background: var(--nb); }
.dropzone svg { width: 16px; height: 16px; }
.dropzone img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.dropzone .clear-ref {
  position: absolute; right: 5px; top: 5px; z-index: 2;
  width: 20px; height: 20px; border-radius: 6px;
  background: rgba(10,12,18,.8); color: #fff;
  display: grid; place-items: center; font-size: 14px; line-height: 1;
}
.dropzone .clear-ref:hover { background: var(--err); }

/* ---------- Results ---------- */
.result-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.result-grid.single { grid-template-columns: 1fr; }
.result-item {
  position: relative; border-radius: 8px; overflow: hidden;
  background: #0e1016; border: 1px solid #2c3241;
  aspect-ratio: 1 / 1; cursor: zoom-in;
}
.result-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.result-item .dl-btn {
  position: absolute; right: 5px; bottom: 5px;
  width: 24px; height: 24px; border-radius: 6px;
  background: rgba(10,12,18,.82); color: #fff;
  display: grid; place-items: center; opacity: 0; transition: .15s;
}
.result-item:hover .dl-btn { opacity: 1; }
.result-item .dl-btn svg { width: 13px; height: 13px; }

.media-box {
  border-radius: 9px; overflow: hidden; border: 1px solid #2c3241;
  background: #0b0d13; position: relative;
}
.media-box video { width: 100%; display: block; max-height: 240px; background: #000; }
.audio-box { padding: 11px; }
.audio-box audio { width: 100%; height: 36px; }

.script-box {
  background: #12141c; border: 1px solid #2d3342;
  border-radius: 9px; max-height: 300px; overflow: auto; padding: 4px 0;
}
.script-line {
  padding: 8px 10px; border-bottom: 1px solid #232835;
  display: flex; gap: 9px; align-items: flex-start;
}
.script-line:last-child { border-bottom: none; }
.script-num {
  flex: 0 0 20px; height: 20px; border-radius: 6px;
  background: rgba(242,173,76,.15); color: var(--amber);
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
}
.script-content { font-size: 11px; line-height: 1.6; color: #c4cada; white-space: pre-wrap; word-break: break-word; }

.text-output {
  background: #12141c; border: 1px solid #2d3342; border-radius: 9px;
  padding: 9px 10px; font-size: 11.5px; line-height: 1.65;
  color: #c8cede; white-space: pre-wrap; word-break: break-word;
  max-height: 220px; overflow: auto;
}
.placeholder {
  color: var(--dim); font-size: 11px; text-align: center;
  padding: 14px 8px; border: 1px dashed #2c3241; border-radius: 9px;
}

/* ---------- Empty hint ---------- */
.empty-hint {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%);
  text-align: center; pointer-events: none; z-index: 10;
  transition: opacity .2s;
}
.empty-hint h2 { font-size: 19px; font-weight: 650; margin: 20px 0 8px; letter-spacing: -.3px; }
.empty-hint p { color: var(--muted); font-size: 12.5px; margin: 0 0 20px; }
.empty-hint .btn { pointer-events: auto; margin: 0 5px; }
.empty-visual { display: flex; align-items: center; justify-content: center; gap: 0; }
.ev-node { width: 34px; height: 34px; border-radius: 9px; border: 2px solid; }
.ev-node.n1 { border-color: var(--blue); background: rgba(77,159,255,.16); }
.ev-node.n2 { border-color: var(--purple); background: rgba(165,108,255,.16); }
.ev-node.n3 { border-color: var(--pink); background: rgba(240,98,156,.16); }
.ev-line { width: 42px; height: 2px; background: linear-gradient(90deg, #4d5568, #6d768c); }

/* ---------- Zoom bar ---------- */
.zoom-bar {
  position: absolute; right: 16px; bottom: 16px; z-index: 12;
  display: flex; align-items: center; gap: 2px;
  background: rgba(25, 28, 37, .94); border: 1px solid var(--border-light);
  border-radius: 9px; padding: 3px; box-shadow: 0 6px 20px rgba(0,0,0,.4);
  backdrop-filter: blur(8px);
}
.zoom-bar button {
  min-width: 28px; height: 26px; padding: 0 6px;
  border-radius: 6px; display: grid; place-items: center;
  color: var(--muted); font-size: 15px; transition: .15s;
}
.zoom-bar button:hover { background: #2b3040; color: #fff; }
.zoom-bar #zoom-label { font-size: 11px; min-width: 44px; font-variant-numeric: tabular-nums; }
.zoom-bar svg { width: 14px; height: 14px; }
.zsep { width: 1px; height: 16px; background: var(--border-light); margin: 0 2px; }

/* 底部悬浮 TV Director 工具栏 */
.tv-bar {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px;
  padding: 7px 9px; border-radius: 999px;
  background: rgba(18, 20, 28, .88); backdrop-filter: blur(14px);
  border: 1px solid #2a2f3c; box-shadow: 0 10px 30px rgba(0,0,0,.45);
  z-index: 30;
}
.tv-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; color: #b8bdcb;
  transition: .15s;
}
.tv-btn:hover { background: #262b38; color: #fff; }
.tv-btn svg { width: 19px; height: 19px; }
.tv-sep { width: 1px; height: 22px; background: #2a2f3c; margin: 0 4px; }
.tv-brand {
  display: flex; align-items: center; gap: 7px; height: 38px;
  padding: 0 16px 0 12px; border-radius: 999px;
  background: linear-gradient(135deg, #22c1c3, #4f7cff);
  color: #fff; font-weight: 700; font-size: 13px;
  box-shadow: 0 4px 14px rgba(79, 124, 255, .4);
  transition: .15s;
}
.tv-brand:hover { filter: brightness(1.1); }
.tv-brand svg { width: 17px; height: 17px; }

/* ---------- Popover ---------- */
.popover {
  position: fixed; z-index: 80; width: 176px;
  background: #1b1e28; border: 1px solid var(--border-light);
  border-radius: 10px; padding: 6px; box-shadow: var(--shadow);
}
.pop-title { font-size: 10px; color: var(--dim); padding: 5px 8px 7px; letter-spacing: .5px; }
.pop-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px; border-radius: 7px; text-align: left; font-size: 12px; color: #cbd1e0;
}
.pop-item:hover { background: #292e3e; color: #fff; }
.pop-dot { width: 8px; height: 8px; border-radius: 50%; }
.pop-dot.blue { background: var(--blue); }
.pop-dot.purple { background: var(--purple); }
.pop-dot.pink { background: var(--pink); }
.pop-dot.teal { background: var(--teal); }
.pop-dot.amber { background: var(--amber); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 6, 10, .74); backdrop-filter: blur(5px);
  display: grid; place-items: center; padding: 20px;
}
.modal {
  width: min(660px, 100%); max-height: calc(100vh - 40px);
  background: #171a23; border: 1px solid var(--border-light);
  border-radius: 16px; box-shadow: 0 24px 70px rgba(0,0,0,.65);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-sm { width: min(400px, 100%); }
.modal-lg { width: min(720px, 100%); }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 22px 14px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 11.5px; }
.modal-close { font-size: 22px; color: var(--dim); line-height: 1; padding: 0 2px; }
.modal-close:hover { color: #fff; }
.modal-body { padding: 18px 22px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  background: #141720;
}

.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 11.5px; font-weight: 600; color: #b9c0d2; }
.form-row input {
  width: 100%; height: 36px; padding: 0 11px;
  background: #101219; border: 1px solid #2d3342; border-radius: 8px;
  outline: none; font-size: 12.5px; transition: .15s;
}
.form-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(124,92,255,.16); }
.form-row small { color: var(--dim); font-size: 10.5px; line-height: 1.5; }
.form-row.compact input { height: 32px; font-size: 12px; }

.section-label {
  font-size: 11.5px; font-weight: 700; color: #cfd5e4;
  padding-top: 6px; border-top: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 8px;
}
.section-label span { font-size: 10.5px; color: var(--dim); font-weight: 400; }
.model-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.test-row { display: flex; align-items: center; gap: 12px; padding-top: 4px; }
.test-result { font-size: 11.5px; color: var(--muted); }
.test-result.ok { color: var(--ok); }
.test-result.err { color: var(--err); }

/* 模型勾选白名单 */
.model-pick { display: flex; flex-direction: column; gap: 10px; padding: 10px 11px; background: #0e1017; border: 1px solid var(--border); border-radius: 9px; }
.model-pick-head { font-size: 11.5px; font-weight: 700; color: #cfd5e4; display: flex; align-items: baseline; gap: 8px; }
.model-pick-head span { font-size: 10.5px; color: var(--dim); font-weight: 400; }
.model-pick-group { display: flex; flex-direction: column; gap: 5px; }
.model-pick-title { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.model-pick-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 150px; overflow-y: auto; }
.model-pick-tip { font-size: 11px; color: var(--dim); }
.model-pick-item {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  padding: 4px 8px; border: 1px solid #2d3342; border-radius: 7px;
  background: #12151d; font-size: 11px; color: #b9c0d2; transition: .15s; user-select: none;
}
.model-pick-item:hover { border-color: var(--accent); }
.model-pick-item input { margin: 0; width: 13px; height: 13px; accent-color: var(--accent); cursor: pointer; }
.model-pick-item.checked { border-color: var(--accent); background: rgba(124,92,255,.12); color: #e6e9f2; }
.model-pick-name.aliased { color: #cfc0ff; }
.model-rename-btn {
  display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 1px;
  border-radius: 4px; color: var(--dim); background: transparent; opacity: .55; transition: .14s;
}
.model-rename-btn:hover { color: #fff; opacity: 1; background: #2e3446; }
.model-rename-btn svg { width: 12px; height: 12px; }

.advanced-details { border: 1px solid var(--border); border-radius: 8px; background: #0e1017; }
.advanced-details > summary {
  list-style: none; cursor: pointer; padding: 9px 11px;
  font-size: 11px; font-weight: 600; color: var(--muted); user-select: none;
}
.advanced-details > summary::-webkit-details-marker { display: none; }
.advanced-details > summary::before { content: '▸ '; color: var(--accent); }
.advanced-details[open] > summary::before { content: '▾ '; }
.advanced-details > .form-row { padding: 0 11px 11px; }

.btn {
  height: 34px; padding: 0 14px; border-radius: 8px;
  font-size: 12px; font-weight: 600; transition: .15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn.primary { background: linear-gradient(135deg, #7c5cff, #5a6cff); color: #fff; }
.btn.primary:hover { filter: brightness(1.12); }
.btn.ghost { background: #252a38; border: 1px solid var(--border-light); color: #ccd2e1; }
.btn.ghost:hover { background: #2e3446; color: #fff; }
.btn.danger { background: rgba(255,107,115,.16); border: 1px solid rgba(255,107,115,.45); color: #ff9298; }
.btn.danger:hover { background: rgba(255,107,115,.26); }

/* ---------- Toast ---------- */
.toast-wrap {
  position: absolute; right: 16px; bottom: 62px; z-index: 90;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; align-items: flex-end;
}
.toast {
  min-width: 200px; max-width: 360px;
  padding: 10px 13px; border-radius: 9px;
  background: #212533; border: 1px solid var(--border-light);
  box-shadow: 0 8px 26px rgba(0,0,0,.5);
  font-size: 12px; line-height: 1.5;
  display: flex; align-items: flex-start; gap: 9px;
  animation: toastIn .22s ease;
}
.toast.out { animation: toastOut .2s ease forwards; }
.toast .t-icon { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 1px; }
.toast.ok { border-color: rgba(62,213,152,.4); }
.toast.ok .t-icon { color: var(--ok); }
.toast.err { border-color: rgba(255,107,115,.45); }
.toast.err .t-icon { color: var(--err); }
.toast.info .t-icon { color: var(--accent-2); }
@keyframes toastIn { from { opacity: 0; transform: translateX(14px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(14px); } }

/* ---------- Image lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(5,6,10,.92); display: grid; place-items: center;
  padding: 40px; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.7); }
.lightbox .lb-close { position: absolute; top: 20px; right: 24px; font-size: 28px; color: #fff; }

/* ---------- Image generator (LibTV-style, 三类参考) ---------- */
.node[data-type="image"] { width: 420px; }
.node[data-type="image"] .node-body { padding: 0; gap: 0; }
.igen-stage {
  min-height: 168px; max-height: 320px; margin: 10px 10px 4px; border-radius: 10px;
  overflow: hidden; background: #0a0c11; border: 1px solid #332d47;
  display: flex; align-items: center; justify-content: center;
}
.igen-stage .result-grid { padding: 8px; }
.node[data-type="image"] .igen-btn {
  background: linear-gradient(135deg, #a86bff, #6f5cff);
  box-shadow: 0 4px 14px rgba(168,107,255,.25);
}

/* 参考区：干净的缩略图网格（图片/视频/音频），去掉名称/标题/加号 */
.vref-line { gap: 5px; }
.vref-items { flex: 1; min-width: 0; display: flex; gap: 7px; flex-wrap: wrap; align-items: flex-start; }

/* ---------- Video generator (LibTV-style) ---------- */
.node[data-type="video"] { width: 452px; }
.node[data-type="video"] .node-body { padding: 0; gap: 0; }
.vgen { display: flex; flex-direction: column; }

/* 预览舞台 */
.vstage {
  height: 240px; margin: 10px 10px 4px; border-radius: 10px; overflow: hidden;
  background: #0a0c11; border: 1px solid #2c3241;
  display: flex; align-items: center; justify-content: center;
}
.vstage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.vstage-empty { width: 100%; height: 100%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #1c2030, #0c0e14 70%); }
.vstage-play {
  width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12);
  color: #6c7488;
}
.vstage-play svg { width: 30px; height: 30px; }

/* 生成器面板 */
.vgen-panel { padding: 8px 10px 11px; display: flex; flex-direction: column; gap: 9px; }
.vchip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.gchip {
  height: 26px; padding: 0 10px; border-radius: 7px;
  background: #222634; border: 1px solid #333a4c; color: #b9c0d2;
  font-size: 11px; transition: .15s; white-space: nowrap;
}
.gchip:hover { background: #2c3142; color: #fff; }
.gchip.active { background: var(--nb); border-color: var(--nc); color: var(--nc); }

.vtool-row { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.vtool {
  height: 26px; padding: 0 8px; border-radius: 6px; display: inline-flex;
  align-items: center; gap: 4px; color: #9aa2b5; font-size: 10.5px; transition: .15s;
}
.vtool svg { width: 13px; height: 13px; }
.vtool:hover { background: #262b3a; color: #fff; }

.chip-selected { display: flex; gap: 5px; flex-wrap: wrap; }
.chip-tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 6px 3px 8px; border-radius: 6px;
  background: rgba(240,98,156,.12); border: 1px solid rgba(240,98,156,.3);
  color: #f3a8c8; font-size: 10px;
}
.chip-tag button { color: #f3a8c8; font-size: 13px; line-height: 1; padding: 0; }

/* 引用素材区：嵌在提示词大框内部（上缩略图方块 + 下名称胶囊，横排连续） */
.vrefs {
  display: flex; flex-direction: column; gap: 4px;
  padding: 0 0 7px; margin: 0 0 3px;
  background: transparent; border: 0; border-bottom: 1px solid #262b38;
}
.vrefs:not(:has(.ref-thumb)) { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.ref-empty { font-size: 10.5px; color: var(--dim); padding: 4px; }
.ref-thumb {
  position: relative; width: 46px; overflow: visible; flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 0; background: transparent;
}
.ref-media {
  position: relative; width: 46px; height: 46px; border-radius: 7px;
  overflow: hidden; border: 1px solid #3a4152; background: #0c0e14;
}
.ref-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-video-fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: #1a1424; color: #cba3f2;
}
.ref-video-fallback svg { width: 20px; height: 20px; }
.ref-name {
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  width: 46px; max-width: 46px; padding: 1px 3px; border-radius: 4px;
  background: #1b1e28; border: 1px solid #2d3342; color: #c3c9d8;
  font-size: 9px; line-height: 1.4; white-space: nowrap; overflow: hidden;
}
.ref-name svg { width: 10px; height: 10px; flex: 0 0 auto; color: #9aa2b5; }
.ref-name em { font-style: normal; overflow: hidden; text-overflow: ellipsis; }
.ref-badge {
  position: absolute; left: 3px; bottom: 3px; width: 16px; height: 16px;
  border-radius: 4px; background: rgba(10,12,18,.82); color: #8d95a8;
  display: grid; place-items: center;
}
.ref-badge svg { width: 10px; height: 10px; }
.ref-del {
  position: absolute; right: -4px; top: -4px; width: 16px; height: 16px; z-index: 2;
  border-radius: 50%; background: rgba(10,12,18,.92); color: #fff;
  display: grid; place-items: center; font-size: 11px; line-height: 1;
  opacity: 0; transition: opacity .12s;
}
.ref-thumb:hover .ref-del { opacity: 1; }
.ref-del:hover { background: var(--err); }

/* 提示词大框：缩略图 + 文字同处一个框（对齐 LibTV） */
.vprompt, .agen-prompt {
  position: relative; background: #12141c; border: 1px solid #2d3342;
  border-radius: 9px; padding: 8px 9px 6px;
  transition: border-color .15s, box-shadow .15s;
}
.vprompt:focus-within, .agen-prompt:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 2px rgba(124,92,255,.16);
}
.vprompt .n-textarea, .agen-prompt .n-textarea {
  background: transparent; border: 0; border-radius: 0; padding: 2px 1px;
  min-height: 88px; box-shadow: none;
}
.vprompt .n-textarea:focus, .agen-prompt .n-textarea:focus { border: 0; box-shadow: none; }

/* 提示词框放大按钮 */
.prompt-expand-btn {
  position: absolute; top: 6px; right: 7px; z-index: 3;
  width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 6px; color: var(--dim); background: rgba(20,22,30,.85);
  border: 1px solid #2d3342; opacity: .55; transition: .14s;
}
.prompt-expand-btn:hover { color: #fff; opacity: 1; border-color: var(--accent); background: #23273a; }
.prompt-expand-btn svg { width: 14px; height: 14px; }

/* 放大编辑弹窗 */
.prompt-expand-modal { width: min(880px, 100%); }
.prompt-expand-box { min-height: min(62vh, 560px); display: flex; flex-direction: column; }
.prompt-expand-box #prompt-expand-refs:empty { display: none; }
.prompt-expand-box .n-textarea {
  flex: 1; min-height: 320px; font-size: 13.5px; line-height: 1.7;
  padding: 8px 4px; resize: none;
}

.vfoot { display: flex; flex-direction: column; gap: 7px; }
.vfoot-row { display: flex; gap: 6px; }
.vfoot-row > * { flex: 1; min-width: 0; }
.vfoot-row .n-select { height: 30px; font-size: 11px; padding: 0 24px 0 8px; }
.vgen-btn {
  height: 38px; width: 100%; border-radius: 9px; margin-top: 1px;
  background: linear-gradient(135deg, var(--nc), color-mix(in srgb, var(--nc) 55%, #5a6cff));
  color: #0e1016; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  box-shadow: 0 4px 14px var(--nb); transition: .15s;
}
.vgen-btn svg { width: 15px; height: 15px; }
.vgen-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.vcost {
  margin-left: auto; padding: 3px 8px; border-radius: 6px;
  background: rgba(0,0,0,.22); font-size: 11px; font-weight: 700;
}
.node[data-type="video"] .status-line { font-size: 10px; }

/* ---------- 多类型参考素材（图 / 视频 / 音频） ---------- */
.node[data-type="video"] .vrefs { min-height: 0; }
.vref-line {
  display: flex; align-items: center; gap: 6px; min-height: 28px;
  padding: 2px; border-radius: 6px; transition: background .12s, box-shadow .12s;
}
.vref-line + .vref-line { border-top: 1px dashed #2b3140; }
.vref-line.empty { min-height: 22px; padding: 1px 2px; }
.vref-line.port-hover {
  background: rgba(255,255,255,.05);
  box-shadow: inset 0 0 0 1px var(--nc);
}
.vref-items { flex: 1; min-width: 0; display: flex; gap: 7px; flex-wrap: wrap; align-items: flex-start; }
.vref-empty-hint {
  display: flex; align-items: center; gap: 5px; height: 20px; padding: 0 3px;
  color: #4a5163; font-size: 9.5px;
}
.vref-empty-hint svg { width: 12px; height: 12px; }
.vref-empty-hint i { font-style: normal; }
.ref-thumb.ref-video .ref-media { border-color: #6a4a8f; }
.ref-thumb.ref-audio .ref-media { border-color: #2f8f86; }
.ref-media video { width: 100%; height: 100%; object-fit: cover; display: block; position: relative; z-index: 1; }
.ref-pending {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #5c6577; background: repeating-linear-gradient(45deg,#151922,#151922 5px,#12151d 5px,#12151d 10px);
}
.ref-pending svg { width: 16px; height: 16px; }
.ref-thumb .ref-type-icon {
  position: absolute; left: 2px; top: 2px; width: 14px; height: 14px;
  border-radius: 4px; background: rgba(10,12,18,.8); color: #d7a6ff;
  display: grid; place-items: center;
}
.ref-thumb .ref-type-icon svg { width: 10px; height: 10px; }
.ref-media.ref-audio-icon {
  display: grid; place-items: center;
  color: #5fd3c4; background: #142624;
}
.ref-media.ref-audio-icon svg { width: 24px; height: 24px; }
.ref-thumb .ref-src-label {
  position: absolute; left: 0; right: 0; bottom: 2px;
  text-align: center; font-size: 9px; color: #a9e6de;
}

/* ---------- Audio generator (LibTV-style) ---------- */
.node[data-type="audio"] { width: 420px; }
.node[data-type="audio"] .node-body { padding: 0; gap: 0; }
.agen { display: flex; flex-direction: column; }
.astage {
  height: 140px; margin: 10px 10px 4px; border-radius: 10px; overflow: hidden;
  background: #0b1014; border: 1px solid #2c3b41; padding: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.astage audio { width: 100%; max-width: 360px; }
.astage-head { display: flex; align-items: center; gap: 6px; color: #6fd6c5; font-size: 11px; }
.astage-head svg { width: 16px; height: 16px; }
.astage-empty { width: 100%; height: 100%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 45%, #14262a, #0b1014 70%); }
.astage-wave { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  background: rgba(95,211,196,.06); border: 1px solid rgba(95,211,196,.16); color: #4c9c92; }
.astage-wave svg { width: 26px; height: 26px; }
.agen-panel { padding: 8px 10px 11px; display: flex; flex-direction: column; gap: 9px; }
.agen-prompt textarea { min-height: 74px; }
.node[data-type="audio"] .vgen-btn.agen-btn {
  background: linear-gradient(135deg, #35c7b2, #268f9f);
  box-shadow: 0 4px 14px rgba(53,199,178,.22);
}
.node[data-type="audio"] .gchip.active { background: rgba(53,199,178,.16); border-color: #35c7b2; color: #7ee0d1; }
.node[data-type="audio"] .chip-tag { background: rgba(53,199,178,.12); border-color: rgba(53,199,178,.32); color: #8fe2d5; }
.node[data-type="audio"] .status-line { font-size: 10px; }

/* ---------- Node picker（拖线到空白处选择节点类型） ---------- */
.node-picker {
  position: fixed; z-index: 160; min-width: 180px; padding: 6px;
  background: #1b1e28; border: 1px solid var(--border-light);
  border-radius: 10px; box-shadow: var(--shadow); animation: toastIn .14s ease;
}
.np-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 3px 8px 7px; font-size: 11px; color: #e3e7f0; font-weight: 600;
}
.np-title span { font-size: 9px; color: #737c90; font-weight: 400; }
.np-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 8px; border-radius: 7px; font-size: 12px; color: #cbd1e0; text-align: left;
}
.np-item:hover { background: #2b3040; color: #fff; }
.np-item.primary { background: rgba(124,92,255,.14); color: #c3b5ff; }
.np-item.primary:hover { background: rgba(124,92,255,.24); }
.np-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: #262b39; }
.np-icon svg { width: 14px; height: 14px; }
.np-label { display: flex; align-items: center; gap: 6px; }
.np-label em { font-style: normal; font-size: 9px; padding: 1px 5px; border-radius: 4px; background: #7c5cff; color: #fff; }

/* ---------- Float menu ---------- */
.float-menu {
  position: fixed; z-index: 150; min-width: 120px; max-height: 320px; overflow: auto;
  background: #1b1e28; border: 1px solid var(--border-light);
  border-radius: 9px; padding: 5px; box-shadow: var(--shadow);
  animation: toastIn .14s ease;
}
.float-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 6px 8px; border-radius: 6px; font-size: 11.5px; color: #cbd1e0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.float-menu button:hover { background: #2b3040; color: #fff; }
.float-menu button.active { background: #2b3040; color: #fff; outline: 1px solid #5b6b8c; outline-offset: -1px; }
.float-menu .menu-thumb {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 5px; overflow: hidden;
  display: grid; place-items: center; background: #0c0e14; border: 1px solid #333a4c;
  position: relative;
}
.float-menu .menu-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.float-menu .menu-thumb-video { color: #d7a6ff; }
.float-menu .menu-thumb-video video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.float-menu .menu-thumb-video svg { position: relative; width: 14px; height: 14px; }
.float-menu .menu-thumb-audio { color: #5fd3c4; background: #142624; }
.float-menu .menu-thumb-audio svg { width: 16px; height: 16px; }
.float-menu .menu-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 900px) {
  .sidebar { width: 190px; flex-basis: 190px; }
  .brand { min-width: auto; }
  .brand-tag, .side-guide { display: none; }
  .topbar-center .tbtn:not(.primary) { display: none; }
  .topbar-right .tbtn:not(#btn-settings) { display: none; }
}

/* ============ 登录 / 注册遮罩 ============ */
.auth-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 9, 13, .82);
  backdrop-filter: blur(6px);
}
.auth-card {
  width: min(400px, 92vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 30px 32px;
  box-shadow: var(--shadow);
}
.auth-brand {
  display: flex; align-items: center; gap: 8px; margin-bottom: 20px;
}
.auth-brand .brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}
.auth-brand .brand-mark svg { width: 18px; height: 18px; }
.auth-brand .brand-name { font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.auth-brand .brand-tag { font-size: 9px; color: var(--dim); letter-spacing: 2px; margin-left: 2px; }
.auth-card h2 { margin: 0 0 6px; font-size: 20px; }
.auth-sub { margin: 0 0 22px; font-size: 12.5px; color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label { font-size: 12px; color: var(--muted); }
.auth-field input {
  height: 42px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.auth-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, .18); }
.auth-msg { min-height: 18px; font-size: 12.5px; color: var(--ok); }
.auth-msg.err { color: var(--err); }
.auth-submit {
  height: 44px; border-radius: 9px; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 15px; font-weight: 600;
  transition: opacity .15s, transform .05s;
}
.auth-submit:hover { opacity: .92; }
.auth-submit:active { transform: translateY(1px); }
.auth-submit:disabled { opacity: .55; cursor: not-allowed; }
.auth-switch {
  margin-top: 18px; text-align: center; font-size: 13px; color: var(--muted);
}
.auth-switch button {
  background: none; border: none; color: var(--accent-2);
  font-size: 13px; font-weight: 600; cursor: pointer; padding: 0 2px;
}
.auth-switch button:hover { text-decoration: underline; }

.auth-code-row { display: flex; gap: 8px; }
.auth-code-row input { flex: 1; }
.auth-send {
  flex: 0 0 auto; height: 42px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--panel-2);
  color: var(--accent-2); font-size: 13px; cursor: pointer;
  white-space: nowrap; transition: .15s;
}
.auth-send:hover { border-color: var(--accent); }
.auth-send:disabled { opacity: .55; cursor: not-allowed; }

/* ============ 账号管理后台 ============ */
.admin-modal { width: min(680px, 94vw); }
.admin-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; }
.admin-count { font-size: 13px; color: var(--muted); }
.admin-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.admin-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--border);
}
.admin-row.banned { opacity: .65; }
.admin-row-main { flex: 1; min-width: 0; }
.admin-row-name { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.admin-row-email { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.admin-row-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.admin-status { font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.admin-status.st-active { background: rgba(74, 222, 128, .15); color: #4ade80; }
.admin-status.st-banned { background: rgba(248, 113, 113, .15); color: #f87171; }
.admin-date { font-size: 11px; color: var(--dim); }
.admin-row-actions { display: flex; gap: 6px; }
.admin-tag { font-size: 10px; padding: 2px 7px; border-radius: 6px; background: rgba(124, 92, 255, .2); color: #b8a6ff; }
.admin-tag.self { background: rgba(96, 165, 250, .2); color: #7cb8ff; }
.admin-points { display: flex; align-items: center; gap: 8px; }
.admin-pts-val { font-size: 12.5px; font-weight: 600; color: #ffd66b; white-space: nowrap; }
.admin-pts-edit { display: flex; align-items: center; gap: 4px; }
.admin-pts-input {
  width: 72px; height: 28px; padding: 0 8px; font-size: 12px;
  border-radius: 7px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
}
.admin-loading, .admin-empty { padding: 30px; text-align: center; color: var(--dim); font-size: 13px; }
.admin-msg { font-size: 12.5px; color: var(--err); min-height: 18px; }

.admin-create {
  padding: 14px; border-radius: 12px;
  background: var(--panel-2); border: 1px dashed var(--border);
}
.admin-create-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--text); }
.admin-create-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin-create-row input[type="text"] {
  flex: 1; min-width: 120px; height: 34px; padding: 0 10px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 13px;
}
.admin-create-row input[type="text"]:focus { outline: none; border-color: var(--accent); }
.admin-create-admin { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.admin-create-admin input { accent-color: var(--accent); }
.admin-create-msg { font-size: 12.5px; margin-top: 8px; min-height: 16px; color: var(--muted); }
.admin-create-msg.err { color: var(--err); }
.admin-create-msg.ok { color: #4ade80; }
