/* Promptheus Ember — Chat-UI Styles */
/* Dark theme, Ember/Glut-Farben (Amber/Fire, Hue 35-55) */

:root {
  --bg: #0d0b09;
  --bg-surface: #1a1612;
  --bg-elevated: #231e18;
  --bg-hover: #2d261e;
  --border: #3d3228;
  --border-light: #4a3d30;
  --text: #e8ddd0;
  --text-muted: #9a8b7a;
  --text-dim: #6b5e50;
  --ember: #e8913a;
  --ember-glow: #f4a54a;
  --ember-dim: #c47028;
  --ember-bg: rgba(232, 145, 58, 0.08);
  --success: #5cb85c;
  --error: #d9534f;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- Header --- */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  font-size: 18px;
  font-weight: 600;
  color: var(--ember);
  letter-spacing: -0.3px;
}

.logo span {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 14px;
  margin-left: 8px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-light);
}

.btn-ember {
  background: var(--ember-dim);
  color: #fff;
  border-color: var(--ember);
}

.btn-ember:hover {
  background: var(--ember);
}

/* --- Sidebar (Conversations) --- */

.layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.conv-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.conv-item:hover {
  background: var(--bg-hover);
}

.conv-item.active {
  background: var(--ember-bg);
  border: 1px solid rgba(232, 145, 58, 0.2);
}

.conv-item .conv-content {
  flex: 1;
  min-width: 0;
}

.conv-item .conv-preview {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item .conv-date {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

.conv-delete {
  display: none;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  line-height: 1;
  flex-shrink: 0;
}

.conv-delete:hover {
  color: var(--error);
  background: rgba(217, 83, 79, 0.15);
}

.conv-item:hover .conv-delete {
  display: block;
}

/* --- Chat Area --- */

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
}

.message-user {
  align-self: flex-end;
  background: var(--ember-dim);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message-assistant {
  align-self: flex-start;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.message-assistant p {
  margin-bottom: 8px;
}

.message-assistant p:last-child {
  margin-bottom: 0;
}

.message-assistant code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.message-assistant pre {
  background: var(--bg);
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 8px 0;
  border: 1px solid var(--border);
}

.message-assistant pre code {
  background: none;
  padding: 0;
}

/* Thinking logo (streaming bubble) */
.thinking-logo {
  display: flex;
  align-items: center;
  padding: 2px 0;
  animation: pulse-glow 2s ease-in-out infinite;
}

.thinking-logo svg {
  width: 32px;
  height: 15px;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* Tool indicators */
.tool-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--ember-bg);
  border: 1px solid rgba(232, 145, 58, 0.15);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--ember-glow);
  margin: 4px 0;
  align-self: flex-start;
}

.tool-indicator .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(232, 145, 58, 0.3);
  border-top-color: var(--ember);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.tool-indicator.done {
  color: var(--success);
  border-color: rgba(92, 184, 92, 0.15);
  background: rgba(92, 184, 92, 0.05);
}

.tool-indicator.done .spinner {
  display: none;
}

.tool-indicator.done::before {
  content: '✓';
  font-size: 14px;
}

/* Undo button after edits */
.undo-action {
  align-self: flex-start;
  margin: -8px 0 4px 0;
  display: flex;
  gap: 0;
}

.btn-undo {
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-undo:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-light);
}

.btn-undo:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-undo-done {
  color: var(--success);
  border-color: rgba(92, 184, 92, 0.3);
}

.btn-undo-error {
  color: var(--error);
  border-color: rgba(217, 83, 79, 0.3);
}


/* Diff display */
.diff-block {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin: 8px 0;
  border: 1px solid var(--border);
  background: var(--bg);
}

.diff-block .diff-remove {
  color: var(--error);
  text-decoration: line-through;
  opacity: 0.7;
}

.diff-block .diff-add {
  color: var(--success);
}

/* Preview link */
.preview-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--ember-bg);
  border: 1px solid var(--ember-dim);
  border-radius: var(--radius-sm);
  color: var(--ember-glow);
  text-decoration: none;
  font-size: 13px;
  margin: 8px 0;
  transition: all 0.15s ease;
}

.preview-link:hover {
  background: rgba(232, 145, 58, 0.15);
  border-color: var(--ember);
}

/* Welcome state */
.welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.welcome h2 {
  font-size: 24px;
  color: var(--ember);
  margin-bottom: 8px;
  font-weight: 600;
}

.welcome p {
  font-size: 14px;
  max-width: 400px;
  line-height: 1.6;
}

.welcome .suggestions {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.welcome .suggestion {
  padding: 10px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.welcome .suggestion:hover {
  background: var(--bg-hover);
  border-color: var(--ember-dim);
}

/* --- Input Area --- */

.input-area {
  padding: 16px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.input-row textarea {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  resize: none;
  min-height: 42px;
  max-height: 150px;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.15s ease;
}

.input-row textarea:focus {
  border-color: var(--ember-dim);
}

.input-row textarea::placeholder {
  color: var(--text-dim);
}

.send-btn {
  padding: 10px 20px;
  background: var(--ember);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.send-btn:hover {
  background: var(--ember-glow);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.send-btn.stop {
  background: var(--error);
}

.send-btn.stop:hover {
  background: #c9302c;
}

/* --- Flag Button --- */

.flag-btn {
  padding: 8px 10px;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

/* --- Flag Modal --- */

.flag-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flag-modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 400px;
  max-width: 90vw;
}

.flag-modal-dialog h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.flag-modal-dialog p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.flag-modal-dialog textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  resize: vertical;
  min-height: 60px;
  outline: none;
}

.flag-modal-dialog textarea:focus {
  border-color: var(--ember-dim);
}

.flag-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* --- Selection Chip (mobile: persisted element selection) --- */

.selection-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--ember-bg);
  border: 1px solid rgba(232, 145, 58, 0.25);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.selection-chip-icon {
  font-size: 13px;
  color: var(--ember);
  flex-shrink: 0;
}

.selection-chip-text {
  font-size: 12px;
  color: var(--ember-glow);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-chip-clear {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
}

.selection-chip-clear:hover {
  color: var(--text);
}

/* --- Upload --- */

.upload-btn {
  padding: 8px 10px;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.upload-preview {
  display: flex;
  padding: 8px 0 0;
}

.upload-preview-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-width: 100%;
}

.upload-preview-item img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
}

.upload-preview-name {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.upload-preview-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.upload-preview-remove:hover {
  color: var(--error);
}

.input-area.drag-over {
  background: var(--ember-bg);
  border-top-color: var(--ember-dim);
}

/* --- Login Screen --- */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  flex-direction: column;
  gap: 20px;
}

.login-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 360px;
  text-align: center;
}

.login-box h1 {
  font-size: 22px;
  color: var(--ember);
  margin-bottom: 4px;
}

.login-box p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-box input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  margin-bottom: 12px;
}

.login-box input:focus {
  border-color: var(--ember-dim);
}

.login-box .login-btn {
  width: 100%;
  padding: 10px;
  background: var(--ember);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.login-box .login-btn:hover {
  background: var(--ember-glow);
}

.login-error {
  color: var(--error);
  font-size: 13px;
  margin-top: 8px;
  display: none;
}

/* --- Changelog Panel --- */

.changelog-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.changelog-header {
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.deploy-btn {
  background: var(--success) !important;
  color: #fff !important;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.deploy-btn:hover:not(:disabled) {
  opacity: 0.9;
}

.deploy-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.changelog-header h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.changelog-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 24px;
}

.changelog-entry {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  margin-bottom: 8px;
  transition: background 0.15s ease;
}

.changelog-entry:hover {
  background: var(--bg-hover);
}

.changelog-entry-info {
  flex: 1;
  min-width: 0;
}

.changelog-entry-message {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.changelog-entry-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
  display: flex;
  gap: 12px;
}

.changelog-entry-hash {
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.changelog-entry-actions {
  flex-shrink: 0;
}

.btn-reset {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-reset:hover {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}

.btn-reset:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-reset:disabled:hover {
  background: var(--bg);
  color: var(--text-muted);
  border-color: var(--border);
}

.changelog-empty {
  text-align: center;
  padding: 40px;
  color: var(--text-dim);
  font-size: 14px;
}

/* Active state for changelog button */
.btn.changelog-active {
  background: var(--ember-dim);
  color: #fff;
  border-color: var(--ember);
}

/* Active state for files button */
.btn.files-active {
  background: var(--ember-dim);
  color: #fff;
  border-color: var(--ember);
}

/* --- Files Panel --- */

.files-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.files-toolbar {
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.files-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.files-breadcrumb-segment {
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.files-breadcrumb-segment:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.files-breadcrumb-segment.active {
  color: var(--text);
  cursor: default;
}

.files-breadcrumb-segment.active:hover {
  background: none;
}

.files-breadcrumb-sep {
  color: var(--text-dim);
  font-size: 11px;
}

.files-toolbar-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.files-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  align-content: start;
}

.files-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-size: 14px;
}

.file-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  min-height: 120px;
}

.file-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.file-card-thumb {
  width: 100%;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 4px;
}

.file-card-thumb img {
  max-width: 100%;
  max-height: 80px;
  object-fit: contain;
  border-radius: 4px;
}

.file-card-icon {
  font-size: 36px;
  line-height: 1;
  color: var(--text-dim);
}

.file-card-icon.dir {
  color: var(--ember);
}

.file-card-name {
  font-size: 12px;
  color: var(--text);
  text-align: center;
  word-break: break-all;
  line-height: 1.3;
  max-height: 2.6em;
  overflow: hidden;
}

.file-card-meta {
  font-size: 11px;
  color: var(--text-dim);
}

.file-card-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: none;
  gap: 2px;
}

.file-card:hover .file-card-actions {
  display: flex;
}

.file-card-action {
  width: 24px;
  height: 24px;
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.file-card-action:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.file-card-action.delete:hover {
  background: rgba(217, 83, 79, 0.2);
  color: var(--error);
}

/* Inline rename input */
.file-card-rename {
  width: 100%;
  padding: 2px 4px;
  background: var(--bg);
  border: 1px solid var(--ember-dim);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  text-align: center;
  outline: none;
  font-family: var(--font);
}

/* Drop overlay */
.files-drop-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(232, 145, 58, 0.1);
  border: 2px dashed var(--ember);
  border-radius: var(--radius);
  z-index: 10;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--ember-glow);
  pointer-events: none;
}

.files-panel.drag-over .files-drop-overlay {
  display: flex;
}

/* --- Move Modal --- */

.files-move-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.files-move-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 380px;
  max-width: 90vw;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
}

.files-move-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.files-move-header h3 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.files-move-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.files-move-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease;
}

.files-move-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.files-move-item.selected {
  background: var(--ember-bg);
  color: var(--ember-glow);
  border: 1px solid rgba(232, 145, 58, 0.2);
}

.files-move-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* --- Preview Panel --- */

.preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  min-width: 0;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.preview-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 1;
}

.btn-sm {
  padding: 2px 8px;
  font-size: 16px;
  line-height: 1;
  min-width: 28px;
  text-align: center;
}

.preview-panel iframe {
  flex: 1;
  border: none;
  background: #fff;
  width: 100%;
}

/* When preview is open, chat area gets constrained */
.layout.with-preview .chat-area {
  flex: 1;
  min-width: 320px;
}

.layout.with-preview .preview-panel {
  flex: 1;
  min-width: 320px;
}

/* Preview toggle active state */
.btn.preview-active {
  background: var(--ember-dim);
  color: #fff;
  border-color: var(--ember);
}

/* --- Edit Mode --- */

.btn.edit-active {
  background: var(--ember-dim);
  color: #fff;
  border-color: var(--ember);
}

.preview-edit-info {
  display: none;
  padding: 6px 12px;
  background: var(--ember-bg);
  border-bottom: 1px solid rgba(232, 145, 58, 0.2);
  font-size: 12px;
  color: var(--ember-glow);
  text-align: center;
  flex-shrink: 0;
}

.preview-edit-info.visible {
  display: block;
}

/* --- Scrollbar --- */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* --- Hamburger (hidden on desktop) --- */

.btn-hamburger {
  display: none;
  font-size: 20px;
  padding: 4px 10px;
  line-height: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
}

.btn-hamburger:hover {
  color: var(--text);
  background: var(--bg-hover);
}

/* --- Sidebar Overlay (mobile) --- */

.sidebar-overlay {
  display: none;
}

/* --- Preview Fullscreen (mobile) --- */

.preview-panel.preview-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  border: none;
  display: flex !important;
}

/* --- Responsive --- */

@media (max-width: 768px) {
  /* Hamburger sichtbar */
  .btn-hamburger {
    display: block;
  }

  /* Sidebar: Off-canvas Drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 110;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  /* Overlay hinter Sidebar */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
  }

  .sidebar-overlay.visible {
    display: block;
  }

  /* Header kompakter */
  .header {
    padding: 8px 12px;
  }

  .logo {
    font-size: 16px;
  }

  .logo span {
    font-size: 12px;
    margin-left: 6px;
  }

  .header-right .btn {
    padding: 5px 10px;
    font-size: 12px;
  }

  /* Chat-Bereich */
  .messages {
    padding: 12px 12px;
  }

  .message {
    max-width: 92%;
    padding: 10px 14px;
    font-size: 14px;
  }

  .input-area {
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .input-row textarea {
    font-size: 16px; /* Verhindert iOS-Zoom */
    min-height: 44px;
    padding: 10px 12px;
  }

  .send-btn {
    padding: 10px 16px;
    min-height: 44px;
  }

  /* Welcome */
  .welcome {
    padding: 24px 16px;
  }

  .welcome h2 {
    font-size: 20px;
  }

  .welcome .suggestion {
    padding: 12px 16px;
    font-size: 14px;
  }

  /* Tool-Indicators */
  .tool-indicator {
    font-size: 11px;
    padding: 6px 10px;
  }

  /* Changelog */
  .changelog-entry {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }

  .changelog-entry-actions {
    width: 100%;
  }

  .btn-reset {
    width: 100%;
    padding: 8px 12px;
    text-align: center;
  }

  .changelog-header {
    padding: 10px 16px;
  }

  .changelog-list {
    padding: 10px 12px;
  }

  /* Files Panel */
  .files-toolbar {
    padding: 8px 12px;
  }

  .files-grid {
    padding: 12px;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
  }

  .file-card {
    padding: 10px;
    min-height: 100px;
  }

  .file-card-actions {
    display: flex;
  }

  .files-move-dialog {
    width: calc(100vw - 24px);
  }

  /* Login */
  .login-box {
    width: calc(100vw - 32px);
    max-width: 360px;
    padding: 24px 20px;
  }

  .login-box input {
    font-size: 16px; /* Verhindert iOS-Zoom */
    padding: 12px 14px;
  }

  /* Preview: Fullscreen-Modus */
  .preview-panel.preview-fullscreen .preview-toolbar {
    padding: 10px 12px;
  }
}
