/* ─── Reset & Variables ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d0d0d;
  --surface:   #161616;
  --surface2:  #1e1e1e;
  --surface3:  #252525;
  --border:    #2a2a2a;
  --primary:   #7c3aed;
  --primary-h: #6d28d9;
  --primary-l: #a78bfa;
  --primary-dim: #7c3aed55;
  --text:      #f0f0f0;
  --text-m:    #999;
  --text-d:    #555;
  --success:   #22c55e;
  --success-alt: #10b981;
  --error:     #ef4444;
  --error-h:   #dc2626;
  --warning:   #f59e0b;
  --info:      #3b82f6;
  --info-l:    #60a5fa;
  --info-h:    #2563eb;
  --term-error: #fca5a5;
  --term-bg:   #050505;
  --term-text: #c8ffc8;
  --radius:    10px;
  --radius-sm: 6px;
  --transition: 0.15s ease;
  --nav-h: calc(74px + env(safe-area-inset-bottom, 0px));
  --header-h:  56px;
  --font-mono: 'Cascadia Code', 'Fira Code', 'Consolas', 'Courier New', monospace;
}

html { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ──────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
}

.logo-icon {
  width: 28px; height: 28px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}

.logo-icon-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 50%;
  transition: filter 0.5s;
}

.logo-icon-img.logo-connected {
  animation: logoAura 2.5s ease-in-out infinite;
}

@keyframes logoAura {
  0%, 100% { filter: drop-shadow(0 0 0px rgba(124, 58, 237, 0)); }
  50%       { filter: drop-shadow(0 0 10px rgba(124, 58, 237, 0.9))
                       drop-shadow(0 0 20px rgba(167, 139, 250, 0.4)); }
}

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

#settings-nav-btn.active {
  color: var(--primary-l);
  border-color: var(--primary);
  background: rgba(124,58,237,0.15);
}

#main-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(var(--nav-h) + 16px);
}

/* ─── Bottom Nav ──────────────────────────────────────────────────────── */
nav#main-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  gap: 6px;
  padding-inline: 6px;
}

.nav-menu-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-m);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.nav-menu-btn:hover { color: var(--primary-l); border-color: var(--primary); }

.nav-main-tabs {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 6px;
}

/* ─── App-Bubble ──────────────────────────────────────────────────────── */
.nav-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 7px 10px;
  min-width: 56px;
  cursor: pointer;
  color: var(--text-m);
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.nav-bubble-icon { font-size: 20px; line-height: 1; }
.nav-bubble-label { font-size: 10px; white-space: nowrap; color: inherit; }
.nav-bubble-addon-badge {
  font-size: 8px; font-weight: 700; color: var(--primary-l);
  letter-spacing: .3px; text-transform: uppercase; line-height: 1;
}

.nav-bubble.active {
  background: rgba(124, 58, 237, 0.18);
  border-color: var(--primary);
  color: var(--primary-l);
  animation: bubblePulse 2.8s ease-in-out infinite;
}
@keyframes bubblePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.45); }
  50%       { box-shadow: 0 0 0 7px rgba(124, 58, 237, 0); }
}

/* ─── Sidebar Backdrop ────────────────────────────────────────────────── */
.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.nav-backdrop.visible { opacity: 1; pointer-events: all; }

/* ─── Rechte Modul-Sidebar ────────────────────────────────────────────── */
.nav-sidebar {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 176px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-sidebar.open { transform: translateX(0); }

.nav-sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.nav-sidebar-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.nav-sidebar-close {
  background: none;
  border: none;
  color: var(--text-d);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: color 0.15s;
}
.nav-sidebar-close:hover { color: var(--text); }
.nav-search-btn {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: background 0.15s;
}
.nav-search-btn:hover { background: var(--border); }
.nav-search-wrap { width: 100%; }
.nav-search-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
}
.nav-search-input:focus { border-color: var(--primary); }
.nav-bubble.search-hidden { display: none; }
.nav-bubble.search-match { order: -1; }

.nav-sort-btns {
  display: flex;
  gap: 4px;
}
.nav-sort-btn {
  font-size: 9px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-d);
  cursor: pointer;
  transition: all 0.15s;
}
.nav-sort-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.nav-sidebar-grid {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  gap: 0;
  padding: 0;
}

.nav-col {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 5px 12px;
  scrollbar-width: none;
}
.nav-col::-webkit-scrollbar { display: none; }
.nav-col-apps {
  border-right: 1px solid var(--border);
}
.nav-col-label {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-d);
  margin-bottom: 2px;
}

/* Sidebar-Bubbles sind schmaler */
.nav-sidebar-grid .nav-bubble {
  width: 68px;
  min-width: unset;
  padding: 8px 4px;
}


/* ─── Pages ───────────────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ─── Settings Section Labels ─────────────────────────────────────────── */
.settings-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-d);
  padding: 16px 2px 6px;
  margin-bottom: 0;
}
.settings-section:first-child { padding-top: 4px; }

/* ── Accordion ── */
.acc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  margin: 6px 0 2px;
  background: var(--surface2);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-h);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.acc-header:active { background: var(--border); }
.acc-header.open   { background: color-mix(in srgb, var(--accent) 12%, var(--surface2)); }
.acc-chevron {
  font-size: 18px;
  color: var(--text-d);
  transition: transform 0.25s;
  line-height: 1;
}
.acc-header.open .acc-chevron { transform: rotate(90deg); }
.acc-body {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0 6px;
}
.acc-body.open { display: flex; }

/* ─── Cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-m);
  margin-bottom: 12px;
}

/* ─── Forms ───────────────────────────────────────────────────────────── */
label { display: block; font-size: 13px; color: var(--text-m); margin-bottom: 6px; }

input[type="text"],
input[type="password"],
textarea,
select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  padding: 10px 12px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.2);
}

textarea {
  resize: vertical;
  min-height: 80px;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ─── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  transition: background var(--transition), transform var(--transition), opacity var(--transition);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  user-select: none;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); }

.btn-ghost {
  background: transparent;
  color: var(--text-m);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface3); color: var(--text); }

.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--error-h); }

.btn-full { width: 100%; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ─── Terminal ────────────────────────────────────────────────────────── */
.terminal {
  background: var(--term-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--term-text);
  overflow-y: auto;
  max-height: 45vh;
  min-height: 120px;
  white-space: pre-wrap;
  word-break: break-all;
  position: relative;
}

.terminal.empty::after {
  content: 'Ausgabe erscheint hier…';
  color: var(--text-d);
  font-family: inherit;
}

.term-stderr { color: var(--term-error); }
.term-system { color: var(--text-d); font-style: italic; }

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* ─── Job Status Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-pending   { background: rgba(100,100,100,0.2); color: var(--text-m); }
.badge-running   { background: rgba(59,130,246,0.2);  color: var(--info); }
.badge-completed { background: rgba(34,197,94,0.2);   color: var(--success); }
.badge-failed    { background: rgba(239,68,68,0.2);   color: var(--error); }
.badge-cancelled { background: rgba(245,158,11,0.2);  color: var(--warning); }

.badge-running::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--info);
  animation: pulse 1.2s infinite;
}

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

/* ─── Job List ────────────────────────────────────────────────────────── */
.job-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.job-item:hover { border-color: var(--primary); background: var(--surface2); }
.job-item:active { background: var(--surface3); }

.job-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.job-command {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
  flex: 1;
}

.job-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-d);
  align-items: center;
}

.job-preview {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-m);
  background: var(--surface2);
  border-radius: 4px;
  padding: 6px 8px;
  overflow: hidden;
  max-height: 50px;
  white-space: pre-wrap;
  word-break: break-all;
  border-left: 2px solid var(--border);
  margin-top: 8px;
}

/* ─── Login Screen ────────────────────────────────────────────────────── */
#login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

.login-box {
  width: 100%;
  max-width: 360px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .big-icon {
  width: 64px; height: 64px;
  background: var(--primary);
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 12px;
  box-shadow: 0 8px 32px rgba(124,58,237,0.4);
}

.login-logo h1 { font-size: 22px; font-weight: 700; }
.login-logo p  { color: var(--text-m); font-size: 13px; margin-top: 4px; }

.form-group { margin-bottom: 14px; }

/* Passwortfeld ohne type="password" — Browser-Password-Manager blind */
.masked-input { -webkit-text-security: disc; text-security: disc; }

#login-error {
  color: var(--error);
  font-size: 13px;
  margin-top: 8px;
  text-align: center;
  min-height: 20px;
}

/* ─── Toasts ──────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(var(--nav-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
}

.toast {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  animation: slideUp 0.2s ease;
  pointer-events: auto;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--error); }
.toast.info    { border-left: 3px solid var(--info); }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Spinner ─────────────────────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toggle ──────────────────────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 14px; }
.toggle-desc  { font-size: 12px; color: var(--text-m); margin-top: 2px; }

.toggle {
  position: relative;
  width: 44px; height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle input:checked + .toggle-track { background: var(--primary); border-color: var(--primary); }
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--transition);
}
.toggle input:checked + .toggle-track::after { transform: translateX(20px); }

/* ─── Divider ─────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* ─── Empty state ─────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-m);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ─── Modal ───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  display: none;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: slideSheet 0.2s ease;
}
@keyframes slideSheet {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-weight: 600; font-size: 16px; }
.modal-body  { padding: 16px; overflow-y: auto; flex: 1; }

/* ─── Connection indicator ────────────────────────────────────────────── */
.conn-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-d);
  transition: background 0.3s;
}
.conn-dot.connected    { background: var(--success); }
.conn-dot.connecting   { background: var(--warning); animation: pulse 1s infinite; }
.conn-dot.disconnected { background: var(--error); }

/* ─── Args builder ────────────────────────────────────────────────────── */
.arg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.arg-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 12px;
  font-family: var(--font-mono);
}

.arg-chip button {
  background: none;
  border: none;
  color: var(--text-m);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}

/* Badge in Einstellungen */
.nicos-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-l);
  margin-bottom: 12px;
  box-shadow: 0 0 12px rgba(124,58,237,0.2);
}

/* ─── Chat ────────────────────────────────────────────────────────────── */
#page-chat {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: var(--nav-h);
  display: none;
  flex-direction: column;
  background: var(--bg);
  z-index: 10;
}

#page-chat.active {
  display: flex;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.chat-watermark-wrap {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  z-index: 1;
  user-select: none;
  opacity: 0.12;
}
#page-chat.active .chat-watermark-wrap { display: flex; }

.chat-watermark {
  width: 520px;
  height: 520px;
  object-fit: contain;
  display: block;
}

.chat-watermark-text {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text);
}

.chat-welcome {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 4px;
}

.chat-welcome-icon { font-size: 28px; flex-shrink: 0; }
.chat-welcome-text { font-size: 14px; line-height: 1.6; color: var(--text-m); }
.chat-welcome-text strong { color: var(--text); }

.chat-bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
}

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

.chat-bubble-ai {
  align-self: flex-start;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
  font-family: inherit;
}

.chat-bubble-ai.streaming::after {
  content: '▋';
  animation: blink 0.8s steps(1) infinite;
  color: var(--primary-l);
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.chat-bubble-ai.error { border-color: var(--error); color: var(--error); }

/* ─── Thinking ────────────────────────────────────────────────────────── */
.chat-thinking {
  display: none;
  max-width: 88%;
  margin-bottom: 6px;
}

.chat-thinking summary {
  font-size: 11px;
  color: var(--primary-l);
  cursor: pointer;
  list-style: none;
  padding: 3px 0;
  user-select: none;
}
.chat-thinking summary::-webkit-details-marker { display: none; }
.chat-thinking summary::before { content: '▶ '; font-size: 9px; }
.chat-thinking[open] summary::before { content: '▼ '; }

.chat-thinking-text {
  font-size: 11px;
  color: var(--text-d);
  font-style: italic;
  line-height: 1.5;
  padding: 6px 10px;
  margin-top: 4px;
  background: var(--surface2);
  border-left: 2px solid var(--primary);
  border-radius: 4px;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}

/* ─── Aktivitätslog ───────────────────────────────────────────────────── */
.chat-activity {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 6px;
  max-width: 88%;
}

.chat-activity:empty { display: none; }

.activity-item {
  font-size: 11px;
  color: var(--text-d);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Token-Stats ─────────────────────────────────────────────────────── */
.chat-stats {
  font-size: 10px;
  color: var(--text-d);
  margin-top: 4px;
  padding: 0 4px;
}
.chat-stats:empty { display: none; }

.chat-meta {
  font-size: 10px;
  color: var(--text-d);
  margin-top: 3px;
  padding: 0 4px;
}
.chat-meta-user { text-align: right; }

/* ─── Copy-Button ─────────────────────────────────────────────────────── */
.chat-copy-btn {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-d);
  padding: 2px 4px;
  margin-top: 2px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s, background 0.15s;
}
.chat-copy-btn:hover {
  opacity: 1 !important;
  color: var(--primary);
  background: var(--surface3, rgba(255,255,255,0.06));
}
.chat-copy-btn.copied { color: var(--success); opacity: 1 !important; }
div:hover > .chat-copy-btn { opacity: 0.5; }

/* ─── Markdown in Chat-Bubbles ────────────────────────────────────────── */
.chat-bubble-ai h1, .chat-bubble-ai h2, .chat-bubble-ai h3 {
  margin: 10px 0 4px;
  font-weight: 600;
  line-height: 1.3;
}
.chat-bubble-ai h1 { font-size: 1.15em; }
.chat-bubble-ai h2 { font-size: 1.05em; }
.chat-bubble-ai h3 { font-size: 0.95em; }
.chat-bubble-ai p { margin: 6px 0; }
.chat-bubble-ai ul { margin: 6px 0 6px 16px; padding: 0; }
.chat-bubble-ai li { margin: 2px 0; }
.chat-bubble-ai strong { font-weight: 600; }
.chat-bubble-ai em { font-style: italic; }
.chat-bubble-ai code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
  background: var(--surface3, rgba(0,0,0,0.25));
  padding: 1px 5px;
  border-radius: 3px;
}

/* ─── Code-Block ──────────────────────────────────────────────────────── */
.code-block {
  position: relative;
  margin: 8px 0;
  border-radius: 6px;
  background: var(--surface3, #0d1117);
  border: 1px solid var(--border);
  overflow: hidden;
}
.code-block pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
}
.code-block pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  border-radius: 0;
}
.code-lang {
  display: block;
  font-size: 10px;
  color: var(--text-d);
  padding: 4px 10px 0;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.code-copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-d);
  padding: 3px 5px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
}
.code-copy-btn:hover { opacity: 1 !important; color: var(--primary); }
.code-copy-btn.copied { color: var(--success); opacity: 1 !important; }
.code-block:hover .code-copy-btn { opacity: 0.7; }

/* ─── Modell-Auswahl ──────────────────────────────────────────────────── */
.chat-model-bar {
  display: flex;
  gap: 6px;
  padding: 8px 12px 4px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.model-chip {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-m);
  cursor: pointer;
  transition: all 0.15s;
}

.model-chip:hover {
  border-color: var(--primary);
  color: var(--primary-l);
}

.model-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ── LLM Picker ──────────────────────────────────────────────────────────── */
.llm-picker-wrap {
  position: relative;
  flex-shrink: 0;
}
.llm-picker-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.llm-picker-btn:hover { opacity: 0.85; }
.llm-picker-label { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.llm-picker-arrow { font-size: 10px; opacity: 0.8; }
.llm-picker-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.llm-picker-group-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-d);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 4px 10px 2px;
}
.llm-picker-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-h);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.12s;
}
.llm-picker-item:hover { background: var(--surface3, var(--surface1)); }
.llm-picker-item.active { background: var(--primary); color: #fff; }

.clear-history-btn {
  border-color: var(--border);
  color: var(--text-d);
  font-size: 13px;
}
.clear-history-btn:hover {
  border-color: var(--error);
  color: var(--error);
  background: var(--surface3);
}

.new-chat-btn {
  margin-left: auto;
  border-color: var(--border);
  color: var(--text-d);
}
.new-chat-btn:hover {
  border-color: var(--text-m);
  color: var(--text);
  background: var(--surface3);
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  align-items: flex-end;
  flex-shrink: 0;
}

.chat-input-bar textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  overflow-y: hidden;
}

.chat-upload-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  padding: 0;
  font-size: 18px;
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 2px;
}

.chat-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  padding: 0;
  font-size: 16px;
  flex-shrink: 0;
}

/* ─── Berechtigungsdialog ─────────────────────────────────────────────── */
/* ─── Project Error Banner ────────────────────────────────────────────── */
.project-error-banner {
  position: fixed;
  bottom: var(--nav-h);
  left: 12px;
  right: 12px;
  background: #1e1b2e;
  border: 1px solid var(--warning);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 500;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  animation: slideUp 0.2s ease;
}
.project-error-banner[hidden] { display: none; }
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.peb-icon { font-size: 20px; flex-shrink: 0; }
.peb-body { flex: 1; min-width: 0; }
.peb-title { font-size: 13px; font-weight: 600; color: var(--warning); }
.peb-sub   { font-size: 11px; color: var(--text-d); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peb-actions { display: flex; gap: 6px; flex-shrink: 0; }

.perm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 600;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(6px);
}
.perm-overlay.open { display: flex; }

.perm-dialog {
  background: var(--surface);
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  padding: 24px 20px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 0 40px rgba(245,158,11,0.2);
  animation: slideUp 0.15s ease;
}

.perm-icon   { font-size: 36px; margin-bottom: 10px; }
.perm-title  { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.perm-tool   { font-size: 14px; font-weight: 600; color: var(--warning); margin-bottom: 6px; }

/* ── Gemini Confirm Card ────────────────────────────────────────────────────── */
.gemini-confirm-card {
  margin: 8px 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--primary-dim);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  animation: slideUp 0.2s ease;
}
.perm-detail {
  font-size: 12px; color: var(--text-m);
  background: var(--surface2); border-radius: 6px;
  padding: 8px 10px; margin-bottom: 20px;
  font-family: var(--font-mono); word-break: break-all;
  max-height: 80px; overflow-y: auto; text-align: left;
}
.perm-actions { display: flex; gap: 10px; }
.perm-actions .btn { flex: 1; }

/* ─── Bridge-Tag ─────────────────────────────────────────────────────── */
.bridge-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  background: #1e3a5f;
  color: var(--info-l);
  border: 1px solid var(--info-h);
  border-radius: 3px;
  padding: 0 4px;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

/* ─── Chat Status-Leiste ──────────────────────────────────────────────── */
.chat-status-bar {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 11px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  min-height: 32px;
  flex-shrink: 0;
  overflow: hidden;
}

.chat-status-bar.csb-running,
.chat-status-bar.csb-done,
.chat-status-bar.csb-error { display: flex; }

.chat-status-bar.csb-running { border-top-color: var(--primary); }
.chat-status-bar.csb-done    { border-top-color: var(--success); }
.chat-status-bar.csb-error   { border-top-color: var(--error); }

.csb-activity {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.csb-running .csb-activity { color: var(--primary-l); }
.csb-done    .csb-activity { color: var(--success); }
.csb-error   .csb-activity { color: var(--error); }

.csb-tokens { color: var(--text-d); white-space: nowrap; }
.csb-time   { color: var(--text-d); white-space: nowrap; font-family: var(--font-mono); font-size: 10px; }

.csb-dismiss {
  background: none; border: none;
  color: var(--text-d); cursor: pointer;
  font-size: 14px; line-height: 1;
  padding: 0 2px; flex-shrink: 0;
}
.csb-dismiss:hover { color: var(--text); }

/* ─── Aufträge-Seite ─────────────────────────────────────────────────── */
.auf-chat-item { border-left: 3px solid var(--primary); }

.auf-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.auf-type-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-d);
  white-space: nowrap;
}

.auf-date {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-d);
  white-space: nowrap;
}

.auf-prompt {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
  word-break: break-word;
}

.auf-preview {
  font-size: 11px;
  color: var(--text-m);
  border-left: 2px solid var(--border);
  padding-left: 8px;
  margin-bottom: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60px;
  overflow: hidden;
}

.auf-stats {
  font-size: 10px;
  color: var(--text-d);
}

/* ─── Chat-Datum & Session-Trenner ───────────────────────────────────── */
.chat-date-sep {
  text-align: center;
  font-size: 11px;
  color: var(--text-d);
  padding: 8px 0 4px;
  position: relative;
}
.chat-date-sep::before, .chat-date-sep::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: var(--border);
}
.chat-date-sep::before { left: 0; }
.chat-date-sep::after  { right: 0; }

.chat-session-divider {
  text-align: center;
  font-size: 11px;
  color: var(--primary-l);
  padding: 12px 0 4px;
  opacity: 0.6;
}

/* ─── Chat-Verlauf ────────────────────────────────────────────────────── */
.hist-chat-item {
  border-left: 3px solid var(--primary);
  padding: 10px 12px;
}

.hist-chat-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.hist-model-tag {
  font-size: 10px;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  border-radius: 4px;
  padding: 1px 6px;
  letter-spacing: 0.04em;
}

.hist-date {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-d);
}

.hist-user-msg {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface3);
  border-radius: 12px 12px 12px 4px;
  padding: 7px 11px;
  margin-bottom: 6px;
  word-break: break-word;
  white-space: pre-wrap;
}

.hist-ai-msg {
  font-size: 12px;
  color: var(--text-m);
  padding: 6px 10px;
  border-left: 2px solid var(--border);
  margin-bottom: 6px;
  word-break: break-word;
  white-space: pre-wrap;
  max-height: 80px;
  overflow: hidden;
}

.hist-activities {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 5px;
}

.hist-act-chip {
  font-size: 10px;
  color: var(--text-d);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.hist-stats {
  font-size: 10px;
  color: var(--text-d);
  margin-top: 2px;
}

/* ─── Scrollbar ───────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (min-width: 640px) {
  #main-content { padding: 20px; max-width: 700px; margin: 0 auto; }
  .terminal { max-height: 55vh; }
}

/* Terminal page: full width, fill to nav bar */
#main-content.terminal-mode {
  max-width: none !important;
  padding: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--nav-h) !important;
}

/* ─── Projekt-System ──────────────────────────────────────────────────── */
.auf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.auf-heading { font-size: 16px; font-weight: 600; }

.project-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color .15s;
}
.project-item:active { border-color: var(--primary); }

.project-title {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auf-mode-icon { font-size: 14px; flex-shrink: 0; }

.auf-desc {
  font-size: 12px;
  color: var(--text-m);
  margin: 4px 0 6px;
  word-break: break-word;
}

.auf-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-d);
  margin-top: 4px;
}

.auf-progress-bar {
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  margin: 6px 0 2px;
  overflow: hidden;
}
.auf-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width .3s;
}
.auf-step-info {
  font-size: 10px;
  color: var(--text-d);
}

/* ─── Modal groß ──────────────────────────────────────────────────────── */
.modal-sheet-tall {
  max-height: 92vh;
}

/* ─── Schritt-Formular ────────────────────────────────────────────────── */
.step-row {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.step-row textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--text);
  resize: vertical;
  font-family: inherit;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.req { color: var(--error); }

/* ─── Schritt-Detail ──────────────────────────────────────────────────── */
.step-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.step-detail-row:last-child { border-bottom: none; }

.step-output-preview {
  font-size: 11px;
  color: var(--text-m);
  border-left: 2px solid var(--border);
  padding-left: 8px;
  margin-top: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 80px;
  overflow: hidden;
}

/* ─── Verbesserungs-Box ───────────────────────────────────────────────── */
.improvement-box {
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text);
  margin-top: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ─── Live-Output im Detail-Modal ────────────────────────────────────── */
.pd-live-box {
  margin-top: 8px;
  max-height: 200px;
  font-size: 11px;
}

/* ─── Chat → Aufgabe Button ───────────────────────────────────────────── */
.chat-task-suggest-btn {
  display: block;
  margin: 8px auto;
  animation: fadeIn .3s ease;
}

/* ─── Settings ────────────────────────────────────────────────────────── */
.card input[type="time"],
.card input[type="number"],
.card input[type="text"],
.card select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

/* ─── File Explorer ─────────────────────────────────────────────────── */
/* ── Datei-Explorer: neue Navigationsleiste ─────────────────────── */
.file-nav-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 6px;
}
.file-nav-back {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.file-nav-back:hover { background: var(--bg2); }
.file-nav-back:disabled { opacity: 0.35; cursor: default; }

.file-path-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 10px 0 12px;
  min-width: 0;
  height: 38px;
}
.file-path-display {
  flex: 1;
  font-size: 13px;
  font-family: monospace;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
  text-align: left;
}
.file-path-copy {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-m);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.file-path-copy:hover { background: var(--bg2); color: var(--text); }

.file-location-select {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  margin-bottom: 8px;
  cursor: pointer;
  appearance: auto;
}
.file-location-select.active-section {
  color: var(--primary-l);
  animation: file-loc-pulse 2s ease-in-out infinite;
}
@keyframes file-loc-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

/* altes Kram ausblenden (bleibt für JS-Delegation) */
.file-section-tabs { display: none; }
.file-toolbar      { display: none; }
.file-breadcrumb   { display: none; }

/* ── Action Toolbar ─────────────────────────────────────────────────── */
.file-action-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  flex-wrap: wrap;
}
.file-action-bar .btn { font-size: 12px; padding: 5px 10px; }
.file-action-bar .btn:disabled { opacity: 0.35; cursor: default; }
.file-btn-danger { color: var(--danger, #ef4444) !important; }
.file-btn-danger:hover { background: color-mix(in srgb, var(--danger, #ef4444) 12%, transparent) !important; }

/* ── Search + Sort bar ──────────────────────────────────────────────── */
.file-filter-bar {
  display: flex;
  gap: 8px;
  padding: 4px 0 8px;
}
.file-search,
.file-sort-select {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  font-size: 13px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
  cursor: pointer;
}
.file-search:focus { border-color: var(--accent); }

.file-bc-part { cursor: pointer; color: var(--accent); }
.file-bc-part:hover { text-decoration: underline; }
.file-bc-sep { color: var(--text-d); margin: 0 2px; }

.file-list {
  flex: 1;
  overflow-y: auto;
}
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.1s;
  user-select: none;
}
.file-item:hover  { background: var(--surface2); }
.file-item.selected {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.file-item-icon { font-size: 18px; flex-shrink: 0; width: 24px; text-align: center; }
.file-item-name { flex: 1; font-size: 13px; color: var(--text); word-break: break-all; }
.file-item-meta {
  font-size: 11px;
  color: var(--text-d);
  flex-shrink: 0;
  text-align: right;
  line-height: 1.5;
  white-space: nowrap;
}

/* ── Checkbox in file-item ──────────────────────────────────────────── */
.file-item-check {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  accent-color: var(--accent, #7c3aed);
  cursor: pointer;
}
.file-item.checked {
  background: color-mix(in srgb, var(--accent, #7c3aed) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent, #7c3aed) 35%, transparent);
}

/* ── Bulk-Action-Bar ────────────────────────────────────────────────── */
.file-bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: color-mix(in srgb, var(--accent, #7c3aed) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent, #7c3aed) 30%, transparent);
  border-radius: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.file-bulk-bar[hidden] { display: none; }
.file-bulk-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent, #7c3aed);
  margin-right: 4px;
}

/* ── Favoriten-Bar ──────────────────────────────────────────────────── */
.file-favorites-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.file-favorites-bar[hidden] { display: none; }
.file-fav-label {
  font-size: 11px;
  color: var(--text-d);
  white-space: nowrap;
  flex-shrink: 0;
}
.file-fav-list { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; }
.file-fav-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  font-size: 11px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.file-fav-btn:hover { background: var(--surface3, var(--surface2)); border-color: var(--accent, #7c3aed); }
.file-fav-rm {
  font-size: 13px;
  line-height: 1;
  color: var(--text-d);
  padding: 0 2px;
  cursor: pointer;
  border-radius: 50%;
}
.file-fav-rm:hover { color: var(--danger, #ef4444); background: rgba(239,68,68,0.1); }

/* ── Drag & Drop Overlay ────────────────────────────────────────────── */
.file-list { position: relative; }
.file-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--accent, #7c3aed) 15%, var(--surface));
  border: 2px dashed var(--accent, #7c3aed);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.file-drop-overlay[hidden] { display: none; }
.file-drop-hint {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent, #7c3aed);
  text-align: center;
}
.file-list.file-drop-active { border: 2px dashed var(--accent, #7c3aed); border-radius: 10px; }

/* ── Context Menu ───────────────────────────────────────────────────── */
.file-ctx-menu {
  user-select: none;
  -webkit-user-select: none;
  position: fixed;
  z-index: 9000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  padding: 5px;
  min-width: 190px;
  animation: ctxFadeIn 0.1s ease;
}
.file-ctx-menu[hidden] { display: none; }
@keyframes ctxFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
.file-ctx-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.1s;
}
.file-ctx-item:hover { background: var(--surface2); }
.file-ctx-item:disabled { opacity: 0.35; cursor: default; }
.file-ctx-item.file-ctx-danger { color: var(--danger, #ef4444); }
.file-ctx-item.file-ctx-danger:hover { background: color-mix(in srgb, var(--danger, #ef4444) 12%, transparent); }
.file-ctx-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}

/* ── Download Confirm Modal ─────────────────────────────────────────── */
.file-dl-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.file-dl-overlay[hidden] { display: none; }
.file-dl-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 20px 18px;
  min-width: 260px;
  max-width: 340px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.file-dl-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.file-dl-name {
  font-size: 13px;
  color: var(--text-m);
  font-family: monospace;
  background: var(--bg2);
  padding: 8px 12px;
  border-radius: 8px;
  word-break: break-all;
}
.file-dl-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* ── Editor ─────────────────────────────────────────────────────────── */
.file-editor-panel {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 400;
  display: flex;
  flex-direction: column;
}
.file-editor-panel[hidden] { display: none; }
.file-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-h);
  gap: 10px;
  flex-shrink: 0;
}
.file-editor-area {
  flex: 1;
  resize: none;
  background: var(--bg);
  color: var(--text);
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 16px;
  border: none;
  outline: none;
  overflow-y: auto;
}
.file-preview-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
}
.file-preview-area[hidden] { display: none; }
.file-preview-area h1,.file-preview-area h2,.file-preview-area h3 {
  color: var(--text-h); margin: 1em 0 0.4em; font-weight: 700;
}
.file-preview-area code {
  background: var(--surface2); padding: 2px 5px; border-radius: 4px;
  font-family: monospace; font-size: 12px;
}
.file-preview-area pre {
  background: var(--surface2); padding: 12px; border-radius: 8px; overflow-x: auto;
}
.file-preview-area pre code { background: none; padding: 0; }

/* ─── Step Output Expandable ─────────────────────────────────────────── */
.step-out-toggle {
  margin-top: 5px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-m);
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
  display: inline-block;
}
.step-out-toggle:hover { background: var(--bg-2); color: var(--text); }

.step-output-full {
  margin-top: 6px;
  background: var(--bg-0, #0d1117);
  color: var(--text, #e6edf3);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 11px;
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
}

/* ─── Project Detail Status Message ─────────────────────────────────── */
.pd-status-msg {
  margin-top: 6px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 500;
}
.pd-status-msg.running { background: rgba(59,130,246,.12); color: #60a5fa; }
.pd-status-msg.done    { background: rgba(34,197,94,.12);  color: #4ade80; }
.pd-status-msg.error   { background: rgba(239,68,68,.12);  color: #f87171; }
.pd-status-msg.warn    { background: rgba(234,179,8,.12);  color: #facc15; }

/* ─── Modal breiter ──────────────────────────────────────────────────── */
@media (min-width: 700px) {
  .modal-sheet { max-width: min(900px, 95vw); }
}

/* ─── Agent Reply Box ────────────────────────────────────────────────── */
.pd-reply-box {
  background: var(--bg-2, rgba(255,255,255,.04));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-top: 4px;
  width: 100%;
}
.pd-reply-label {
  font-size: 11px;
  color: var(--text-m);
  margin-bottom: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.pd-reply-quick {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.pd-reply-quick-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
}
.pd-reply-quick-btn:hover { background: var(--bg-2); border-color: var(--primary); }
.pd-reply-input-row {
  display: flex;
  gap: 6px;
}
.pd-reply-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  padding: 6px 10px;
  outline: none;
}
.pd-reply-input:focus { border-color: var(--primary); }

/* ─── Terminal ───────────────────────────────────────────────────────────── */
#page-terminal {
  display: none;
  flex-direction: column;
  padding: 0;
}
#page-terminal.active {
  display: flex;
  flex: 1;
  min-height: 0;
}
.term-toolbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 8px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.term-btn-row {
  display: grid;
  gap: 6px;
  width: 100%;
}
.term-btn-row:first-child { grid-template-columns: repeat(6, 1fr); }
.term-btn-row:last-child  { grid-template-columns: repeat(5, 1fr); }
.term-key-btn {
  background: var(--surface3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 4px;
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition);
  user-select: none;
}
.term-key-btn:active { background: var(--primary); color: #fff; }
.term-key-reconnect {
  background: var(--surface);
  color: var(--text-m);
  font-size: 16px;
}
#terminal-container {
  flex: 1;
  overflow: hidden;
  background: #000;
  padding: 4px;
}
#terminal-container .xterm {
  height: 100%;
}
#terminal-container .xterm-viewport {
  overflow-y: auto !important;
}

/* ── Chat History Panel ───────────────────────────────────────────────────── */
.chat-hist-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 199;
}
.chat-hist-overlay.open { display: block; }

.chat-hist-panel {
  position: fixed;
  top: 0;
  left: -100%;
  width: 82%;
  max-width: 320px;
  height: 100%;
  background: var(--surface);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: left 0.3s cubic-bezier(.4,0,.2,1);
  box-shadow: 4px 0 24px rgba(0,0,0,.45);
}
.chat-hist-panel.open { left: 0; }

.chat-hist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
  padding-top: max(16px, env(safe-area-inset-top));
}

.chat-hist-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.chat-hist-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  flex-shrink: 0;
}

.chat-hist-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.chat-hist-item:hover, .chat-hist-item:active { background: var(--surface-2); }

.chat-hist-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-hist-item-meta {
  font-size: 11px;
  color: var(--text-m);
  display: flex;
  gap: 8px;
}

.chat-hist-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.chat-hist-item-resume {
  font-size: 11px;
  color: var(--primary);
}

.chat-hist-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.4;
  padding: 2px 4px;
  border-radius: 4px;
  transition: opacity 0.15s;
  line-height: 1;
}
.chat-hist-delete-btn:hover { opacity: 1; background: var(--surface3); }

/* ── Dev-Projekt Wizard ───────────────────────────────────────────── */
.dp-step-title {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  width: 100%;
}
.dp-step-title:focus { outline: none; border-color: var(--accent); }

#dp-steps-preview {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 2px;
}

#stalled-banner { animation: slideUp .3s ease; }

@keyframes slideUp {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to   { transform: translateX(-50%); opacity: 1; }
}

/* ── Projekte-Seite ─────────────────────────────────────────────────────────── */

.proj-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-d);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}

.proj-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color .15s;
}
.proj-card:active { border-color: var(--primary); }

.proj-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.proj-type-icon { font-size: 16px; flex-shrink: 0; }
.proj-card-title { flex: 1; font-weight: 600; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.proj-card-body { font-size: 12px; }

.proj-card-progress { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.proj-progress-bar-bg { flex: 1; height: 4px; background: var(--bg3); border-radius: 4px; overflow: hidden; }
.proj-progress-bar-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }
.proj-progress-text { font-size: 11px; color: var(--text-d); white-space: nowrap; }

.proj-card-meta { color: var(--text-d); font-size: 11px; margin-top: 3px; }

.proj-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ── MY TASKS ──────────────────────────────────────────────────────────────── */

/* Profil-Leiste */
.mt-level-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-l);
  white-space: nowrap;
  background: rgba(124,58,237,.15);
  padding: 4px 10px;
  border-radius: 20px;
}
.mt-xp-wrap { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mt-xp-track { height: 6px; background: var(--surface3); border-radius: 6px; overflow: hidden; }
.mt-xp-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-l)); border-radius: 6px; transition: width .5s ease; }
.mt-xp-label { font-size: 10px; color: var(--text-d); }
.mt-streak-badge { font-size: 13px; font-weight: 600; color: #fb923c; white-space: nowrap; }

/* Coach-Karte */
.mt-coach-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(124,58,237,.08);
  border: 1px solid rgba(124,58,237,.25);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  animation: slideUp .25s ease;
  position: relative;
}
.mt-coach-card[hidden] { display: none; }
.mt-coach-avatar { font-size: 22px; flex-shrink: 0; }
.mt-coach-body { flex: 1; min-width: 0; }
.mt-coach-text { font-size: 13px; color: var(--text); white-space: pre-line; line-height: 1.5; }
.mt-coach-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.mt-coach-close {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; color: var(--text-d); cursor: pointer;
  font-size: 14px; padding: 2px 6px;
}
.mt-coach-close:hover { color: var(--text); }

/* Vorschläge */
.mt-suggestions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.mt-suggestion {
  background: var(--surface);
  border-left: 3px solid var(--warning);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-m);
  line-height: 1.4;
}

/* Toolbar */
.mt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
}
.mt-filter-tabs { display: flex; gap: 4px; }
.mt-filter-tab, .mail-acc-tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-m);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}
.mt-filter-tab.active, .mt-filter-tab:hover,
.mail-acc-tab.active, .mail-acc-tab:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.gm-tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-m);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s;
}
.gm-tab.active, .gm-tab:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Aufgabenliste */
.mt-task-list { display: flex; flex-direction: column; gap: 8px; }
.mt-empty-state { text-align: center; padding: 40px 20px; color: var(--text-d); font-size: 14px; }
.mt-loading { text-align: center; padding: 30px; color: var(--text-d); font-size: 13px; }

/* Task-Karte */
.mt-task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  transition: border-color .2s;
}
.mt-task-card:hover { border-color: var(--primary); }
.mt-task-card.mt-task-done { opacity: 0.5; }
.mt-task-card.mt-task-inprog {
  border-color: var(--warning);
  background: rgba(245,158,11,0.06);
}
.mt-inprog-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--warning);
  margin-right: 6px;
  vertical-align: middle;
  animation: mt-pulse 1.5s infinite;
}
@keyframes mt-pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.mt-task-main { display: flex; align-items: flex-start; gap: 10px; }

/* Focus section */
.mt-focus-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.mt-focus-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.mt-focus-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.mt-focus-hint {
  font-size: 11px;
  color: var(--text-d);
}
.mt-focus-list { display: flex; flex-direction: column; gap: 6px; }
.mt-focus-empty { font-size: 12px; color: var(--text-d); padding: 4px 0; }
.mt-focus-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  gap: 8px;
}
.mt-focus-item.mt-focus-inprog {
  border-color: var(--warning);
  background: rgba(245,158,11,0.08);
}
.mt-focus-item-title {
  font-size: 13px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mt-focus-item-actions { display: flex; gap: 4px; flex-shrink: 0; }
.mt-focus-start-btn, .mt-focus-stop-btn, .mt-focus-check-btn, .mt-focus-rm-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-d);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 7px;
  transition: all .15s;
}
.mt-focus-start-btn:hover { color: var(--warning); border-color: var(--warning); }
.mt-focus-stop-btn:hover  { color: var(--warning); border-color: var(--warning); }
.mt-focus-check-btn:hover { color: var(--success); border-color: var(--success); }
.mt-focus-rm-btn:hover    { color: var(--danger); border-color: var(--danger); }

/* start/focus action buttons */
.mt-start-btn { color: var(--warning); }
.mt-focus-btn { color: var(--primary); }

.mt-check-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--border);
  background: none;
  color: var(--text-d);
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .2s;
}
.mt-check-btn:hover { border-color: var(--success); color: var(--success); background: rgba(34,197,94,.12); }
.mt-done-icon { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; color: var(--success); font-size: 14px; flex-shrink: 0; }

.mt-task-info { flex: 1; min-width: 0; }
.mt-task-title { font-size: 14px; color: var(--text); font-weight: 500; margin-bottom: 4px; word-break: break-word; }
.mt-task-meta { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-top: 4px; }

.mt-cat { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: var(--surface2); color: var(--text-m); }
.mt-due { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: rgba(245,158,11,.12); color: var(--warning); }
.mt-postpone-count { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: rgba(239,68,68,.12); color: var(--error); }
.mt-xp-badge { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: rgba(124,58,237,.15); color: var(--primary-l); font-weight: 600; }

/* Urgency badges */
.mt-urg-badge {
  font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 10px;
  white-space: nowrap; flex-shrink: 0; margin-left: auto;
}
.mt-urg-low  { background: rgba(34,197,94,.12);  color: #4ade80; }
.mt-urg-med  { background: rgba(245,158,11,.12); color: var(--warning); }
.mt-urg-high { background: rgba(249,115,22,.12); color: #f97316; }
.mt-urg-crit { background: rgba(239,68,68,.15);  color: var(--error); animation: pulse 1.5s infinite; }

/* Task-Aktionen */
.mt-task-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 8px;
  border-top: 1px solid var(--border);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height .25s ease, opacity .2s ease, margin-top .25s ease, padding-top .25s ease;
  margin-top: 0; padding-top: 0; border-top: none;
}
.mt-task-desc {
  font-size: 12px;
  color: var(--text-m);
  white-space: pre-wrap;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height .25s ease, opacity .2s ease, margin-top .25s ease;
  margin-top: 0;
}
.mt-task-card.mt-expanded .mt-task-desc {
  max-height: 200px;
  opacity: 1;
  margin-top: 6px;
}
.mt-task-card.mt-expanded .mt-task-actions {
  max-height: 120px;
  opacity: 1;
  margin-top: 10px; padding-top: 8px;
  border-top: 1px solid var(--border);
}
.mt-task-card { cursor: pointer; }
.mt-task-card .mt-check-btn,
.mt-task-card .mt-action-btn { cursor: pointer; }
.mt-action-btn {
  font-size: 12px; padding: 4px 12px;
  border-radius: 8px; border: 1px solid var(--border);
  background: none; color: var(--text-m); cursor: pointer;
  transition: all .15s;
}
.mt-action-btn:hover { background: var(--surface2); color: var(--text); }
.mt-del-btn:hover { border-color: var(--error); color: var(--error); }
.mt-edit-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Modal */
.mt-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; padding: 20px;
}
.mt-modal-backdrop[hidden] { display: none; }
.mt-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  width: 100%; max-width: 400px;
  display: flex; flex-direction: column; gap: 14px;
}
.mt-modal-title { font-size: 16px; font-weight: 700; color: var(--text); margin: 0; }
.mt-form-group { display: flex; flex-direction: column; gap: 5px; }
.mt-label { font-size: 12px; color: var(--text-m); }
.mt-input {
  padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2); color: var(--text);
  font-size: 14px; width: 100%;
}
.mt-input:focus { outline: none; border-color: var(--primary); }
select.mt-input option { background: var(--surface2); }
.mt-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}

/* Profil-Bar als Button */
.mt-profile-bar {
  width: 100%;
  text-align: left;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  transition: border-color .15s;
}
.mt-profile-bar:hover { border-color: var(--primary); }
.mt-profile-chevron { color: var(--text-d); font-size: 12px; margin-left: auto; flex-shrink: 0; }

/* Stats Panel */
.mt-stats-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.mt-stats-panel[hidden] { display: none; }
.mt-stats-row { display: flex; gap: 8px; margin-bottom: 14px; }
.mt-stat-box {
  flex: 1; text-align: center;
  background: var(--surface2);
  border-radius: 10px;
  padding: 10px 6px;
}
.mt-stat-num { font-size: 22px; font-weight: 700; color: var(--primary-l); }
.mt-stat-lbl { font-size: 11px; color: var(--text-d); margin-top: 2px; }

/* Badges */
.mt-badges-title { font-size: 12px; color: var(--text-m); font-weight: 600; margin-bottom: 10px; text-transform: uppercase; letter-spacing: .5px; }
.mt-badges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
.mt-badge-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 10px 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  text-align: center;
  transition: all .15s;
}
.mt-badge-earned {
  background: rgba(124,58,237,.12);
  border-color: rgba(124,58,237,.3);
}
.mt-badge-locked {
  background: var(--surface2);
  opacity: .4;
  filter: grayscale(1);
}
.mt-badge-icon { font-size: 24px; }
.mt-badge-label { font-size: 10px; color: var(--text-m); line-height: 1.2; }

/* Level-Up Overlay */
.mt-levelup-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000;
  animation: fadeIn .2s ease;
}
.mt-levelup-overlay[hidden] { display: none; }
.mt-levelup-box {
  text-align: center;
  animation: popIn .3s ease;
}
.mt-levelup-star { font-size: 60px; animation: spin 1s ease; display: block; }
.mt-levelup-title { font-size: 32px; font-weight: 900; color: #fff; letter-spacing: 2px; margin-top: 8px; }
.mt-levelup-level { font-size: 48px; font-weight: 900; color: var(--primary-l); margin-top: 4px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes spin { from { transform: rotate(-20deg) scale(.8); } to { transform: rotate(20deg) scale(1.2); } }

/* Wöchentliche XP-Leiste */
.mt-weekly-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.mt-weekly-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.mt-weekly-label { font-size: 11px; color: var(--text-m); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.mt-weekly-xp { font-size: 11px; color: var(--primary-l); font-weight: 700; }
.mt-weekly-fill { height: 100%; background: linear-gradient(90deg, var(--warning), var(--error)); border-radius: 6px; transition: width .5s ease; }
.mt-weekly-footer { display: flex; justify-content: space-between; margin-top: 5px; }
.mt-weekly-tasks { font-size: 10px; color: var(--text-d); }
.mt-milestones-hit { font-size: 10px; color: var(--warning); font-weight: 600; }

/* Milestones Liste */
.mt-milestones-list { display: flex; flex-direction: column; gap: 4px; }
.mt-milestone-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 8px;
  font-size: 12px;
}
.mt-milestone-hit { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.2); }
.mt-milestone-miss { background: var(--surface2); border: 1px solid var(--border); }
.mt-milestone-icon { font-size: 14px; flex-shrink: 0; }
.mt-milestone-week { color: var(--text-m); flex-shrink: 0; min-width: 70px; }
.mt-milestone-xp { color: var(--primary-l); font-weight: 600; flex: 1; }
.mt-milestone-tasks { color: var(--text-d); flex-shrink: 0; }

/* Nova Coach Feed */
.mt-coach-feed-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.mt-coach-feed-header {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--primary-l); margin-bottom: 8px;
}
.mt-coach-feed { display: flex; flex-direction: column; gap: 6px; min-height: 20px; }
.mt-coach-feed:empty::after { content: 'Noch keine Nachrichten von Nova.'; font-size: 12px; color: var(--text-d); }
.mt-coach-feed-item {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 13px; line-height: 1.4; color: var(--text);
}
.mt-coach-feed-time {
  font-size: 10px; color: var(--text-d); flex-shrink: 0;
  padding-top: 2px; min-width: 36px;
}
.mt-coach-feed-text { flex: 1; }
.mt-coach-trigger-btn { margin-top: 10px; font-size: 11px; }

/* Nova Mini-Chat */
.mt-nova-chat {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 14px;
}
.mt-nova-messages {
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 12px 8px;
  max-height: 220px; overflow-y: auto;
  scroll-behavior: smooth;
}
.mt-nova-messages:empty::after {
  content: '💡 Nova lädt…'; font-size: 12px; color: var(--text-d);
}
.mt-nova-msg {
  max-width: 85%; padding: 7px 11px;
  border-radius: 12px; font-size: 13px; line-height: 1.45;
  word-break: break-word;
}
.mt-nova-model {
  align-self: flex-start;
  background: var(--surface2); color: var(--text);
  border-bottom-left-radius: 4px;
}
.mt-nova-user {
  align-self: flex-end;
  background: var(--primary); color: #fff;
  border-bottom-right-radius: 4px;
}
.mt-nova-typing { color: var(--text-d); font-style: italic; }
.mt-nova-input-row {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
}
.mt-nova-input {
  flex: 1; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 7px 14px; font-size: 13px; color: var(--text);
  outline: none;
}
.mt-nova-input:focus { border-color: var(--primary); }
.mt-nova-send {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  border: none; cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: opacity .15s;
}
.mt-nova-send:disabled { opacity: .4; cursor: default; }

/* ─── Voice ──────────────────────────────────────────────────────────── */
#main-content.voice-mode {
  padding: 0 !important;
  overflow: hidden !important;
}

#page-voice.active {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  height: 100%;
}

/* Top bar */
.voice-modebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 500px;
  margin-bottom: 0;
  padding: 4px 0;
  gap: 8px;
  flex-shrink: 0;
}
.voice-mode-toggle {
  display: flex;
  background: var(--surface2);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.voice-mode-opt {
  padding: 6px 14px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-m);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.voice-mode-opt.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* Center stage — overlay above brain */
.voice-stage {
  position: relative;
  z-index: 10;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  width: 100%;
  padding: 0 16px 60px;
  pointer-events: none;
}
.voice-stage > * { pointer-events: auto; }

/* Status text */
.voice-status {
  font-size: 13px;
  color: var(--text-d);
  text-align: center;
  transition: color 0.3s;
  min-height: 18px;
  letter-spacing: 0.01em;
}
.voice-status.listening { color: var(--accent); font-weight: 600; }
.voice-status.thinking  { color: var(--text-m); }
.voice-status.speaking  { color: var(--success-alt); font-weight: 600; }
.voice-status.error     { color: var(--error); font-weight: 600; }

/* Waveform (hidden, kept for compat) */
.voice-wave[hidden] { display: none; }
.voice-wave { display: none; }

/* ── Brain Voice Button — Vollbild ── */
.voice-brain-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: linear-gradient(180deg, #04091a 0%, #060d20 50%, #090f28 100%);
  overflow: hidden;
  z-index: 0;
}

/* Canvas layers */
#voice-brain-bg, #voice-brain-fx {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
}
#voice-brain-bg { z-index: 2; }
#voice-brain-fx { z-index: 8; pointer-events: none; }

/* Pulse rings */
.voice-brain-ring {
  position: absolute;
  top: 45%; left: 50%;
  width: min(80vw, 320px); height: min(60vw, 240px);
  border-radius: 50%;
  border: 1px solid rgba(168, 85, 247, 0.4);
  transform: translate(-50%, -50%);
  animation: voiceBrainPulse 2.8s ease-out infinite;
  z-index: 3;
  pointer-events: none;
}
.voice-brain-ring:nth-child(3) { animation-delay: 0.93s; }
.voice-brain-ring:nth-child(4) { animation-delay: 1.86s; }
@keyframes voiceBrainPulse {
  0%   { transform: translate(-50%, -50%) scale(0.8); opacity: 0.6; }
  100% { transform: translate(-50%, -50%) scale(2.4); opacity: 0; }
}

/* Recording: cyan rings */
.voice-brain-stage.recording .voice-brain-ring {
  border-color: rgba(34, 211, 238, 0.5);
  animation-duration: 1s;
}
/* Speaking: green rings */
.voice-brain-stage.speaking-state .voice-brain-ring {
  border-color: rgba(16, 185, 129, 0.5);
  animation-duration: 0.9s;
}

/* Brain image — clickable, zentriert im Vollbild */
.voice-brain-img {
  position: absolute;
  top: 42%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  width: min(95vw, 374px);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
/* Float wird via JS gesteuert für perfekte Sync mit Canvas */
.voice-brain-img img {
  width: 100%;
  filter:
    drop-shadow(0 0 16px rgba(100, 180, 255, 0.45))
    drop-shadow(0 0 32px rgba(168, 85, 247, 0.3))
    brightness(1.1);
  transition: filter 0.3s;
}
.voice-brain-img:active img { filter: brightness(1.4) drop-shadow(0 0 24px rgba(255,255,255,0.5)); }

/* Recording: cyan tint */
.voice-brain-stage.recording .voice-brain-img img {
  filter:
    drop-shadow(0 0 20px rgba(34, 211, 238, 0.7))
    drop-shadow(0 0 40px rgba(34, 211, 238, 0.4))
    brightness(1.2) hue-rotate(160deg);
}
/* Speaking: green tint */
.voice-brain-stage.speaking-state .voice-brain-img img {
  filter:
    drop-shadow(0 0 20px rgba(16, 185, 129, 0.7))
    drop-shadow(0 0 40px rgba(16, 185, 129, 0.4))
    brightness(1.2) hue-rotate(100deg);
}

/* Bottom fog — übergang zu Nav */
.voice-brain-fog {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 120px;
  background: linear-gradient(0deg, rgba(4,9,26,0.85) 0%, rgba(76,29,149,0.15) 60%, transparent 100%);
  z-index: 4;
  pointer-events: none;
}

/* Subtitle */
.voice-subtitle {
  font-size: 12px;
  color: var(--text-m);
  text-align: center;
  max-width: 300px;
  line-height: 1.5;
  min-height: 18px;
  transition: opacity 0.4s;
}

.voice-stop { margin-top: -8px; }

/* ── History log — oben als Overlay ── */
.voice-history {
  position: relative;
  z-index: 10;
  width: 100%;
  padding: 8px 12px 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 130px;
  overflow-y: auto;
  background: linear-gradient(to bottom, rgba(4,9,26,0.75) 80%, transparent);
}
.voice-history-empty {
  font-size: 11px;
  color: var(--text-d);
  text-align: center;
  padding: 6px 0;
}
.voice-history-item {
  font-size: 11px;
  color: var(--text-d);
  line-height: 1.4;
  padding: 4px 8px;
  background: var(--surface2);
  border-radius: 6px;
  border-left: 2px solid var(--accent);
}
.voice-history-item.nova { border-left-color: var(--success-alt); }
.voice-history-item span {
  font-size: 10px;
  opacity: 0.5;
  margin-right: 4px;
}

/* Big nav buttons at bottom */
.voice-nav-btns {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 500px;
  padding: 12px 0 4px;
  flex-shrink: 0;
}
.voice-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 12px;
  border: none;
  border-radius: 18px;
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.voice-nav-btn:active { transform: scale(0.96); background: var(--surface); }
.voice-nav-icon { font-size: 28px; line-height: 1; }
.voice-nav-label { font-size: 13px; font-weight: 600; color: var(--text-m); }


/* ── GenesisBrain ─────────────────────────────────────────────────────────── */
.gb-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.gb-status-dot.gb-online  { background: var(--success); box-shadow: 0 0 6px var(--success); }
.gb-status-dot.gb-offline { background: var(--text-d); }

.gb-tabs { margin-bottom: 12px; overflow-x: auto; white-space: nowrap; }

.gb-panel { animation: fadeIn .15s ease; }

.gb-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.gb-card-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-m);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 8px;
}

.gb-health-grid,
.gb-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.gb-stats-grid { grid-template-columns: repeat(4, 1fr); }

.gb-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface3);
  border-radius: 8px;
  padding: 8px 4px;
}
.gb-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-l);
  line-height: 1.2;
}
.gb-stat-lbl {
  font-size: 10px;
  color: var(--text-d);
  margin-top: 2px;
  text-align: center;
}

/* Level-Balken */
.gb-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 12px;
}
.gb-bar-lbl { width: 60px; color: var(--text-m); flex-shrink: 0; }
.gb-bar-track {
  flex: 1;
  height: 6px;
  background: var(--surface3);
  border-radius: 3px;
  overflow: hidden;
}
.gb-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width .4s ease;
}
.gb-bar-count { width: 28px; text-align: right; color: var(--text-d); flex-shrink: 0; }

/* Memory-Liste */
.gb-mem-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color .15s;
}
.gb-mem-item:hover { border-color: var(--primary); }
.gb-mem-item-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.gb-mem-item-meta  { font-size: 11px; color: var(--text-m); display:flex; gap:10px; flex-wrap:wrap; }
.gb-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface3);
  color: var(--text-m);
  border: 1px solid var(--border);
}
.gb-badge.immutable { border-color: var(--warning); color: var(--warning); }
.gb-badge.entropy-C { border-color: var(--danger, #ef4444); color: var(--danger, #ef4444); }
.gb-badge.entropy-super { border-color: var(--text-m); color: var(--text-m); }

/* Detail-Panel */
.gb-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.gb-detail-overlay[hidden] { display: none; }
.gb-detail {
  background: var(--surface2);
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.gb-detail-content {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 40vh;
  overflow-y: auto;
  background: var(--surface3);
  border-radius: 6px;
  padding: 10px;
}

/* Audit-Log */
.gb-audit-list { max-height: 60vh; overflow-y: auto; }
.gb-audit-row {
  display: flex;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.5;
  border-bottom: 1px solid var(--border);
}
.gb-audit-row:last-child { border-bottom: none; }
.gb-audit-ts    { color: var(--text-d); flex-shrink: 0; width: 52px; }
.gb-audit-event { font-weight: 600; color: var(--primary-l); flex-shrink: 0; min-width: 130px; }
.gb-audit-agent { color: var(--text-m); flex-shrink: 0; min-width: 80px; }
.gb-audit-detail { color: var(--text-m); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Tickets */
.gb-ticket {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.gb-ticket-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.gb-ticket-action { font-weight: 600; font-size: 13px; }
.gb-ticket-meta { font-size: 11px; color: var(--text-m); }
.gb-ticket-actions { display:flex; gap:6px; margin-top:8px; }

/* Config */
.gb-config-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.gb-config-row:last-child { border-bottom: none; }
.gb-config-key   { flex: 1; color: var(--text-m); font-size: 12px; }
.gb-config-val   { width: 90px; }
.gb-config-input {
  width: 100%;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 6px;
  font-size: 12px;
  color: var(--text);
}
.gb-config-save  { flex-shrink: 0; }

/* ─── Chat Tagline ────────────────────────────────────────────────────────── */
.chat-tagline {
  background: #000;
  color: var(--primary-l);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-align: center;
  padding: 4px 12px;
  flex-shrink: 0;
  user-select: none;
}

/* ── Drive File Explorer ─────────────────────────────────────────────────────── */
.drive-explorer { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.drive-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
  user-select: none;
  -webkit-user-select: none;
}
.drive-row:last-child { border-bottom: none; }
.drive-row-folder { cursor: pointer; }
.drive-row-folder:active { background: var(--bg-hover); }
.drive-row-icon { font-size: 18px; flex-shrink: 0; width: 24px; text-align: center; }
.drive-row-name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-row-meta { font-size: 11px; color: var(--text-d); flex-shrink: 0; white-space: nowrap; }
.drive-row-actions { display: flex; gap: 4px; flex-shrink: 0; }
.drive-act-btn {
  background: none; border: none; cursor: pointer;
  font-size: 14px; padding: 2px 6px; border-radius: 4px;
  color: var(--text-m); transition: background .15s;
}
.drive-act-btn:hover { background: var(--bg-hover); }
.drive-act-del { color: var(--danger) !important; }

/* Drive breadcrumb */
#drive-breadcrumb { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#drive-breadcrumb button { flex-shrink: 0; }
.drive-bc-item { font-size: 12px; color: var(--text-d); cursor: pointer; }
.drive-bc-item:hover { color: var(--text); }
.drive-bc-sep { font-size: 12px; color: var(--text-d); }

/* Drive + Mail context menu (shared styles) */
#drive-ctx-menu, #mail-ctx-menu {
  position: fixed; z-index: 9999;
  background: #1a1a2e; border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,.8);
  min-width: 180px; overflow: hidden; display: none;
  backdrop-filter: none;
}
#drive-ctx-menu button, #mail-ctx-menu button {
  display: block; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  padding: 11px 16px; font-size: 13px; color: var(--text);
  transition: background .12s;
}
#drive-ctx-menu button:hover, #mail-ctx-menu button:hover { background: var(--bg-hover); }
#drive-ctx-menu button.danger, #mail-ctx-menu button.danger { color: var(--danger); }
#drive-ctx-menu .ctx-sep, #mail-ctx-menu .ctx-sep { height: 1px; background: var(--border); margin: 2px 0; }

/* Drive context submenu */
.ctx-submenu-wrap { position: relative; }
.ctx-submenu-wrap > button { width: 100%; text-align: left; background: none; border: none; cursor: pointer; padding: 11px 16px; font-size: 13px; color: var(--text); transition: background .12s; }
.ctx-submenu-wrap > button:hover { background: var(--bg-hover); }
.ctx-submenu {
  display: none;
  position: absolute; left: 100%; top: 0;
  background: #1a1a2e; border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,.8);
  min-width: 180px; overflow: hidden; z-index: 10000;
}
.ctx-submenu-wrap:hover .ctx-submenu,
.ctx-submenu-wrap.open .ctx-submenu { display: block; }
.ctx-submenu button { display: block; width: 100%; text-align: left; background: none; border: none; cursor: pointer; padding: 11px 16px; font-size: 13px; color: var(--text); transition: background .12s; }
.ctx-submenu button:hover { background: var(--bg-hover); }
@media (max-width: 600px) {
  .ctx-submenu { left: 0; top: 100%; }
}

/* ─── Addon System ─────────────────────────────────────────────────────────── */
.addon-list { display: flex; flex-direction: column; gap: 10px; padding: 10px; }

.addon-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
}
.addon-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.addon-card-icon { font-size: 24px; flex-shrink: 0; }
.addon-card-info { flex: 1; min-width: 0; }
.addon-card-name { font-size: 14px; font-weight: 600; color: var(--text); }
.addon-card-desc { font-size: 12px; color: var(--text-m); margin-top: 2px; }
.addon-card-footer { display: flex; align-items: center; gap: 8px; }
.addon-card-version { font-size: 11px; color: var(--text-d); flex: 1; }
.addon-error-hint { font-size: 11px; color: var(--warning); cursor: default; }

/* Status-Punkt */
.addon-status-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}
.addon-status-running       { background: var(--success); }
.addon-status-starting,
.addon-status-installing,
.addon-status-installing_queued,
.addon-status-update_pending { background: var(--warning); animation: mt-pulse 1.5s infinite; }
.addon-status-crashed,
.addon-status-install_failed { background: var(--error); }
.addon-status-stopped       { background: var(--text-d); }

/* Toggle-Schalter */
.addon-toggle { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.addon-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.addon-toggle-slider {
  width: 36px; height: 20px; background: var(--surface3);
  border-radius: 10px; transition: background var(--transition);
  border: 1px solid var(--border);
}
.addon-toggle-slider::after {
  content: ''; position: absolute; width: 14px; height: 14px;
  border-radius: 50%; background: var(--text-d);
  top: 3px; left: 3px; transition: transform var(--transition), background var(--transition);
}
.addon-toggle input:checked + .addon-toggle-slider { background: var(--primary); border-color: var(--primary); }
.addon-toggle input:checked + .addon-toggle-slider::after { background: #fff; transform: translateX(16px); }

/* Addon-Seite (Host für Web Component) */
.addon-host { width: 100%; height: 100%; }

/* Leer-Zustand */
.addon-empty {
  text-align: center; color: var(--text-d); font-size: 13px;
  padding: 40px 20px; line-height: 1.8;
}

/* "Neue Addons gefunden" Hinweis */
.addon-install-hint {
  margin: 10px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--primary-dim);
  border-left: 3px solid var(--primary); border-radius: var(--radius);
}
.addon-install-hint-title { font-size: 13px; font-weight: 600; color: var(--primary-l); margin-bottom: 8px; }
.addon-install-hint-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0; border-top: 1px solid var(--border); font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DESKTOP LAYOUT — ab 1024px
   ═══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {

  /* ── 1. Nav: Bottom-Bar → linke Leiste ─────────────────────────────────── */
  nav#main-nav {
    position: fixed;
    top: 0; left: 0; bottom: 0; right: auto;
    width: 70px; height: 100%;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 16px 0;
    gap: 6px;
    border-top: none;
    border-right: 1px solid var(--border);
    padding-inline: 0;
    z-index: 100;
  }

  .nav-main-tabs {
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
  }

  .nav-bubble        { min-width: 50px; padding: 10px 6px; }
  .nav-bubble-label  { display: none; }
  .nav-menu-btn      { margin-top: auto; }

  /* ── 2. Header: um Linksleiste versetzt ─────────────────────────────────── */
  #app > header {
    margin-left: 70px;
  }

  /* ── 3. Main Content: CSS Grid — explizite Spalten ─────────────────────── */
  #main-content {
    margin-left: 70px;
    padding: 0;
    display: grid !important;
    grid-template-columns: 260px 1fr;
    grid-template-rows: 1fr;
    overflow: hidden;
    max-width: none;
    height: calc(100vh - var(--header-h));
  }

  /* Auf anderen Seiten als Chat: Chat-Panel-Spalte ausblenden */
  #main-content:not(:has(#page-chat.active)) {
    grid-template-columns: 0 1fr;
  }

  #main-content.terminal-mode {
    margin-left: 70px;
    padding-bottom: 0 !important;
  }

  /* ── 4. Chat-Verlauf: Grid-Spalte 1 ─────────────────────────────────────── */
  .chat-hist-overlay { display: none !important; }

  .chat-hist-panel {
    grid-column: 1;
    grid-row: 1;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: auto !important;
    height: 100%;
    box-shadow: none;
    border-right: 1px solid var(--border);
    transition: none !important;
    z-index: 1;
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
  }

  /* ── 5. Seiten: Grid-Spalte 2 ────────────────────────────────────────────── */
  .page.active {
    grid-column: 2;
    grid-row: 1;
    min-height: 0;
    overflow-y: auto;
    height: 100%;
    padding: 24px;
  }

  /* Chat-Seite: aus Fixed-Overlay in Grid-Spalte 2 überführen ──────────────── */
  #page-chat.active {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    z-index: auto;
    grid-column: 2;
    grid-row: 1;
    display: flex !important;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    min-height: 0;
    height: 100%;
  }

  .chat-tagline    { padding-top: 20px; flex-shrink: 0; width: 100%; }
  .chat-messages   { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px; width: 100%; }
  .chat-model-bar  { flex-shrink: 0; width: 100%; }
  .chat-input-bar  { flex-shrink: 0; width: 100%; padding: 10px 16px 16px; box-sizing: border-box; }
  .chat-status-bar { flex-shrink: 0; width: 100%; }

  /* ── 6. Modals: zentriert statt Fullscreen ──────────────────────────────── */
  .modal-overlay {
    align-items: center;
    justify-content: center;
    padding: 24px;
  }

  .modal-sheet {
    border-radius: 16px;
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
  }

  .modal-sheet-tall {
    max-height: 90vh;
  }
}
