:root {
  --bg: #0f1115;
  --bg2: #161a21;
  --bg3: #1e242e;
  --bg-hover: #262d3a;
  --fg: #e6e9ef;
  --dim: #8a93a3;
  --accent: #4da3ff;
  --accent-fg: #06131f;
  --ok: #3fb96f;
  --err: #e05d5d;
  --border: #2a3140;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --radius: 10px;
  --radius-sm: 6px;
}

:root[data-theme="light"] {
  --bg: #f3f5f9;
  --bg2: #ffffff;
  --bg3: #eef1f6;
  --bg-hover: #e4e9f1;
  --fg: #1a1f29;
  --dim: #667085;
  --accent: #2f7fe0;
  --accent-fg: #ffffff;
  --ok: #1c8a4b;
  --err: #c53838;
  --border: #dde2ea;
  --shadow: 0 1px 2px rgba(30, 41, 59, 0.06), 0 8px 24px rgba(30, 41, 59, 0.08);
  --shadow-sm: 0 1px 2px rgba(30, 41, 59, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 14px/1.55 -apple-system, "Segoe UI", system-ui, sans-serif; height: 100vh;
  display: flex; flex-direction: column;
  transition: background-color 0.2s ease, color 0.2s ease;
}

::selection { background: var(--accent); color: var(--accent-fg); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--dim); background-clip: content-box; }

.hidden { display: none !important; }
.dim { color: var(--dim); }
.error { color: var(--err); white-space: pre-wrap; }
h1, h2, h3 { margin: 0.2em 0; letter-spacing: -0.01em; }

a { color: var(--accent); }

button {
  background: var(--bg3); color: var(--fg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 13px; cursor: pointer; font-size: 13px;
  font-family: inherit; transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}
button:hover:not(:disabled) { border-color: var(--accent); background: var(--bg-hover); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: wait; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

button.primary {
  background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600;
}
button.primary:hover:not(:disabled) { filter: brightness(1.08); border-color: var(--accent); }
button.icon-btn {
  padding: 6px 8px; display: inline-flex; align-items: center; justify-content: center;
}
button.dim-btn {
  background: transparent; border-color: transparent; color: var(--dim); padding: 5px 10px;
}
button.dim-btn:hover:not(:disabled) { background: var(--bg3); border-color: var(--border); color: var(--fg); }

input, select, textarea {
  background: var(--bg2); color: var(--fg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 9px; font-size: 13px; font-family: inherit;
  transition: border-color 0.15s ease;
}
textarea { width: 100%; resize: vertical; }
code { background: var(--bg3); padding: 1px 5px; border-radius: 4px; font-size: 0.92em; }

.icon { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; flex-shrink: 0; }

/* Key-Screen */
.key-screen {
  position: fixed; inset: 0; background: var(--bg); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.key-box {
  background: var(--bg2); padding: 32px 34px; border-radius: var(--radius); width: 380px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.key-box h1 { display: flex; align-items: center; gap: 10px; font-size: 20px; }
.key-box input { width: 100%; margin: 14px 0 8px; }
.key-box button { width: 100%; padding: 9px; margin-top: 4px; }

.logo-mark {
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #7c5cff);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px;
}

/* Header */
header {
  display: flex; align-items: center; gap: 14px; padding: 10px 16px;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm); position: relative; z-index: 5;
}
.brand { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 9px; }
.mode-area { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
.badge {
  padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--bg3); border: 1px solid var(--border);
}
.badge.running { border-color: var(--ok); color: var(--ok); }
.mode-btn.active { border-color: var(--accent); color: var(--accent); background: var(--bg-hover); }
.header-right { display: flex; align-items: center; gap: 8px; }
.banner {
  padding: 7px 16px; background: #382c0f; color: #ffd479; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
:root[data-theme="light"] .banner { background: #fff3d6; color: #8a5a00; }

/* Layout */
main { display: flex; flex: 1; min-height: 0; }
nav {
  width: 216px; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px;
  border-right: 1px solid var(--border); background: var(--bg2); overflow-y: auto;
}
.nav-btn {
  text-align: left; padding: 9px 12px; display: flex; align-items: center; gap: 10px;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--fg);
}
.nav-btn:hover:not(.active) { background: var(--bg3); border-color: transparent; }
.nav-btn.active {
  background: var(--bg3); border-color: var(--border); color: var(--accent); font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-btn .icon { color: inherit; }
.status-box {
  margin-top: auto; font-size: 11px; color: var(--dim);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 10px; word-break: break-word;
}
.stat-title { color: var(--fg); font-weight: 600; margin: 8px 0 3px; }
.stat-title:first-child { margin-top: 0; }
.stat-row { display: flex; justify-content: space-between; gap: 8px; }
.stat-bar { height: 5px; background: var(--bg3); border-radius: 3px; overflow: hidden; margin: 2px 0 5px; }
.stat-fill { height: 100%; background: var(--accent); transition: width .4s; }
.stat-fill.warn { background: #d9a33a; }
.stat-fill.crit { background: var(--err); }
.stat-meta { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border); }
.tab { flex: 1; display: flex; flex-direction: column; padding: 16px 18px; min-width: 0; overflow-y: auto; }
.tab-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; flex-wrap: wrap; gap: 8px; }

.panel {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-sm);
}

/* Chat */
.chat-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.chat-controls select { max-width: 280px; }
.inline { color: var(--dim); font-size: 13px; }
.inline input { width: 64px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; min-height: 8px; margin-top: 8px; }
.chip {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 99px;
  padding: 2px 10px; font-size: 12px; display: inline-flex; gap: 6px; align-items: center;
}
.chip button { border: none; background: none; color: var(--dim); padding: 0 2px; font-size: 12px; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px 4px; display: flex; flex-direction: column; gap: 12px; }
.msg {
  max-width: 85%; padding: 10px 14px; border-radius: 12px; background: var(--bg2);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.msg.user { align-self: flex-end; background: var(--bg3); }
.msg .who { font-size: 11px; color: var(--dim); margin-bottom: 3px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.msg .content { white-space: pre-wrap; word-break: break-word; }
.msg .content.md { white-space: normal; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 0.7em; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { margin: 0.9em 0 0.4em; line-height: 1.25; }
.md h1 { font-size: 1.35em; } .md h2 { font-size: 1.2em; } .md h3 { font-size: 1.08em; }
.md h4, .md h5, .md h6 { font-size: 1em; }
.md ul, .md ol { margin: 0 0 0.7em; padding-left: 1.5em; }
.md li { margin: 0.15em 0; }
.md li > ul, .md li > ol { margin: 0.2em 0 0; }
.md a { color: var(--accent); }
.md code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em;
  background: var(--bg3); padding: 1px 5px; border-radius: 4px; }
.md pre.md-code { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; margin: 0 0 0.8em; overflow-x: auto; white-space: pre; }
.md pre.md-code code { background: none; padding: 0; font-size: 0.88em; }
.md blockquote { margin: 0 0 0.7em; padding: 2px 12px; border-left: 3px solid var(--border); color: var(--dim); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 0.9em 0; }
.md table { border-collapse: collapse; margin: 0 0 0.8em; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--border); padding: 4px 9px; text-align: left; }
.md th { background: var(--bg3); }
.runs-pager { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
.runs-pager button { padding: 4px 10px; font-size: 12px; }
.msg details { margin-bottom: 6px; font-size: 12px; color: var(--dim); }
.msg details pre { white-space: pre-wrap; max-height: 160px; overflow-y: auto; }
.msg .usage { font-size: 11px; color: var(--dim); margin-top: 6px; }
.usage .cached { color: var(--ok); }
.chat-input { display: flex; gap: 8px; margin-top: 12px; align-items: flex-end; }
.chat-input textarea { flex: 1; }
.chat-input button { padding: 9px 20px; }

/* Dateien */
#dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 22px;
  text-align: center; margin-bottom: 16px; transition: border-color 0.15s ease, background-color 0.15s ease;
}
#dropzone.over { border-color: var(--accent); background: var(--bg2); }
.bar { height: 8px; background: var(--bg3); border-radius: 4px; margin-top: 10px; overflow: hidden; }
#upload-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px; overflow-y: auto; align-content: start;
}
.card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; font-size: 13px; box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { border-color: var(--dim); }
.card .name { font-weight: 600; word-break: break-all; }
.card .meta { color: var(--dim); font-size: 12px; margin: 4px 0; }
.card .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.card .actions button { padding: 4px 9px; font-size: 12px; }
.card img, .card video { max-width: 100%; border-radius: var(--radius-sm); display: block; margin-bottom: 8px; background: var(--bg3); }
a.dl {
  display: inline-block; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px 9px; font-size: 12px; color: var(--fg); text-decoration: none;
  transition: border-color 0.15s ease;
}
a.dl:hover { border-color: var(--accent); }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.empty-state { color: var(--dim); text-align: center; padding: 30px 10px; }

/* ComfyUI */
.comfy-layout { display: flex; gap: 18px; align-items: flex-start; flex: 1; min-height: 0; }
.comfy-form { flex: 1 1 380px; min-width: 300px; max-width: 520px; display: flex; flex-direction: column; gap: 12px; }
.comfy-side { flex: 1 1 420px; min-width: 300px; display: flex; flex-direction: column; min-height: 0; }
.comfy-controls { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.comfy-controls label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dim); flex: 1; }
.wf-select { width: 100%; }
.comfy-field {
  display: flex; flex-direction: column; gap: 5px;
}
.comfy-field label { font-size: 12px; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.comfy-field textarea { font-size: 13px; }
.comfy-field input[type="file"] { font-size: 12px; }
.comfy-field label.inline { text-transform: none; font-weight: 400; font-size: 13px; letter-spacing: normal; flex-direction: row; align-items: center; gap: 6px; }
.field-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--dim); padding-top: 12px; border-top: 1px solid var(--border);
}
.res-row { display: flex; gap: 8px; align-items: center; }
.res-row input[type="number"] { width: 88px; }
.res-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.chip-btn { padding: 4px 11px; font-size: 12px; border-radius: 99px; }
.chip-btn.active { border-color: var(--accent); color: var(--accent); background: var(--bg-hover); font-weight: 600; }
.field-hint {
  font-size: 12px; color: var(--dim); line-height: 1.5; margin: 2px 0 0;
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.field-hint code { color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
.image-preview {
  max-width: 200px; max-height: 150px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); margin-top: 6px; display: none;
}
.comfy-json-details { }
.comfy-json-details summary {
  cursor: pointer; font-size: 13px; color: var(--dim); padding: 4px 0;
}
.comfy-json-details[open] summary { margin-bottom: 6px; }
.json-editor {
  font-family: ui-monospace, "SF Mono", monospace; font-size: 12px; min-height: 180px;
  background: var(--bg2);
}
.saved-to { font-size: 11px; color: var(--dim); word-break: break-all; margin-top: 4px; }

/* Job-Warteschlange */
.comfy-queue { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; margin-top: 8px; flex: 1; min-height: 120px; }
.job-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 11px 13px; font-size: 13px; box-shadow: var(--shadow-sm);
}
.job-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.job-title { font-weight: 600; }
.job-status {
  padding: 2px 10px; border-radius: 99px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--border); background: var(--bg3); white-space: nowrap;
}
.job-status.running { border-color: var(--accent); color: var(--accent); }
.job-status.done { border-color: var(--ok); color: var(--ok); }
.job-status.error, .job-status.interrupted, .job-status.cancelled { border-color: var(--err); color: var(--err); }
.job-meta { color: var(--dim); font-size: 12px; margin: 4px 0; }
.job-prompt {
  font-size: 12px; font-style: italic; color: var(--fg); margin: 2px 0 6px;
  white-space: pre-wrap; word-break: break-word;
}
.job-media { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 9px; }
.job-media img, .job-media video { max-width: 260px; max-height: 220px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg3); }
.job-card .actions { display: flex; gap: 6px; margin-top: 9px; }
.job-card .actions button { padding: 4px 9px; font-size: 12px; }

/* Spinner */
.spinner {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: translateY(0); } }
.tab:not(.hidden) { animation: fade-in 0.15s ease; }

/* Benutzer (Admin) */
.user-form { display: flex; gap: 8px; margin: 8px 0; }
.user-form input { flex: 1; max-width: 340px; }
.user-key {
  background: var(--bg3); border: 1px solid var(--ok); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 12px; word-break: break-all; white-space: pre-wrap;
}
.user-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 6px; border-bottom: 1px solid var(--border);
}
.user-row:last-child { border-bottom: none; }
.user-row .user-info { font-weight: 600; }
.user-row .user-info .dim { display: block; font-weight: 400; font-size: 12px; margin-top: 2px; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 50; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.modal-box {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  width: min(720px, 90vw); max-height: 80vh; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-head button { border: none; background: none; color: var(--dim); font-size: 15px; padding: 2px 6px; }
#modal-body { padding: 14px 16px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; font-size: 12px; }

/* Lightbox (Bild vergroessern, in Warteschlange + Ergebnissen) */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 60;
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
}
.lightbox img { max-width: 92vw; max-height: 92vh; object-fit: contain; border-radius: 4px; cursor: default; }
.lightbox-close {
  position: absolute; top: 16px; right: 20px; background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.3); color: #fff; font-size: 16px;
  width: 34px; height: 34px; border-radius: 50%; padding: 0;
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); border-color: #fff; }
.job-media img, .card img { cursor: zoom-in; }

@media (max-width: 900px) {
  .comfy-layout { flex-direction: column; }
  .comfy-form { max-width: none; }
}

@media (max-width: 760px) {
  main { flex-direction: column; }
  nav {
    width: 100%; flex-direction: row; flex-wrap: wrap; border-right: none;
    border-bottom: 1px solid var(--border); padding: 8px;
  }
  .nav-btn { flex: 1 1 auto; justify-content: center; }
  .status-box { display: none; }
  .tab { padding: 12px; }
}

/* Bestaetigungsdialog (ersetzt confirm()) */
.confirm-box { width: min(440px, 90vw); }
.confirm-text { padding: 18px 16px; white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px 14px; }

/* LoRA-Upload (Admin) */
#lora-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
#loras-list h4 { margin: 14px 0 4px; font-size: 13px; }

/* LoRA-Auswahl (Generieren) */
.lora-row { margin-bottom: 6px; }
.lora-row select { flex: 1; min-width: 0; }
.lora-row input[type="number"] { width: 84px; }
#comfy-lora-add { margin-top: 2px; }

/* CFG + Laeufe, Trigger-Hinweise */
.cfg-runs { gap: 16px; }
.cfg-runs-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.cfg-runs-field input { width: 96px; }
.lora-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12px; margin: -2px 0 8px; }
.lora-hint:empty { display: none; }

.run-settings { white-space: normal; word-break: break-word; }

/* Prompt-Generator (MiniMax H3) */
.promptgen { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; }
.promptgen > summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: 0.03em; }
.promptgen-body { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; }
.promptgen-body input[type="text"], .promptgen-body textarea { font-size: 13px; }
#pg-shots { display: flex; flex-direction: column; gap: 6px; }
.pg-shot { display: flex; flex-direction: column; gap: 3px; }
.pg-shot-time { font-size: 11px; color: var(--accent); font-variant-numeric: tabular-nums; }
.pg-shot-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.refchips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
#comfy-refchips-list { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.refchip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 3px; }
.refchip img { width: 22px; height: 22px; object-fit: cover; border-radius: 50%; }

/* Ergebnisse: gleich hohe Kacheln, Prompt eingeklappt, Mehrfachauswahl */
.runs-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.runs-tools button.danger:not(:disabled) { color: var(--err); border-color: var(--err); }
#runs-grid .run-card { display: flex; flex-direction: column; position: relative; }
#runs-grid .run-card img, #runs-grid .run-card video { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
#runs-grid .run-card .actions { margin-top: auto; padding-top: 8px; }
.job-prompt.clamp, .clamp2 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.job-prompt.clamp { -webkit-line-clamp: 3; line-clamp: 3; }
.clamp2 { -webkit-line-clamp: 2; line-clamp: 2; }
.run-more { align-self: flex-start; padding: 0 4px; font-size: 12px; margin-bottom: 4px; }
.run-pick {
  position: absolute; top: 18px; left: 20px; width: 18px; height: 18px; margin: 0;
  cursor: pointer; z-index: 1; accent-color: var(--accent);
}

/* Prompt-Generator: Formular links, gespeicherte Prompts rechts */
.pgen-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.pgen-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.pgen-side { border-left: 1px solid var(--border, #333); padding-left: 14px; position: sticky; top: 0; max-height: calc(100vh - 40px); overflow-y: auto; }
@media (max-width: 1000px) { .pgen-layout { grid-template-columns: 1fr; } .pgen-side { border-left: 0; padding-left: 0; position: static; max-height: none; } }
.pgen-item { border: 1px solid var(--border, #333); border-radius: 6px; padding: 8px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.pgen-item.active { border-color: var(--accent, #6aa9ff); }
.pgen-item .thumbs { display: flex; gap: 4px; flex-wrap: wrap; }
.pgen-item .thumbs img { height: 56px; width: auto; max-width: 90px; object-fit: cover; border-radius: 4px; }
.pgen-item .meta { font-size: 11px; color: var(--dim); }
.pgen-item .txt { font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 4.8em; overflow: hidden; }
.pgen-item .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.settings-box { width: min(900px, 94vw); max-height: 90vh; display: flex; flex-direction: column; }
.settings-body { overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.settings-body textarea { width: 100%; font-family: ui-monospace, monospace; font-size: 12px; }
.settings-body label button { margin-left: 8px; }
