@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg:        #0e0f11;
  --bg2:       #15171a;
  --bg3:       #1c1f23;
  --border:    #2a2d33;
  --yellow:    #f5c842;
  --yellow2:   #e6b520;
  --blue:      #4a8cff;
  --blue2:     #2d6fdd;
  --text:      #e8eaed;
  --muted:     #7a8090;
  --muted2:    #50555f;
  --success:   #3ecf8e;
  --radius:    10px;
  --font:      'DM Sans', sans-serif;
  --mono:      'DM Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* ── LOGIN GATE ── */
.login-gate {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.login-gate.hidden { display: none; }

.login-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  max-width: 380px;
  width: 100%;
}
.login-box .logo-mark {
  width: 48px; height: 48px;
  background: var(--yellow);
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 20px; color: #000;
  margin-bottom: 16px;
}
.login-box h2 {
  font-size: 20px; font-weight: 600; margin-bottom: 6px;
}
.login-box p {
  font-size: 13px; color: var(--muted); margin-bottom: 24px;
}
.login-input {
  width: 100%; padding: 12px 16px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text);
  font-family: var(--font); font-size: 14px;
  outline: none; text-align: center;
  transition: border-color 0.15s;
}
.login-input:focus { border-color: var(--yellow); }
.login-input.error { border-color: #e05555; animation: shake 0.3s; }

.login-btn {
  width: 100%; padding: 12px;
  background: var(--yellow); color: #000;
  border: none; border-radius: 10px;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  cursor: pointer; margin-top: 12px;
  transition: background 0.15s;
}
.login-btn:hover { background: var(--yellow2); }

.login-error {
  color: #e05555; font-size: 12px; margin-top: 10px;
  min-height: 18px;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ── APP WRAPPER ── */
.app-wrapper { display: none; width: 100%; height: 100%; }
.app-wrapper.visible { display: flex; }

/* ── SIDEBAR ── */
.sidebar {
  width: 240px; min-width: 240px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}

.logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.logo-mark {
  width: 32px; height: 32px;
  background: var(--yellow); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; color: #000;
}
.logo-text { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }
.logo-sub  { font-size: 10px; color: var(--muted); font-weight: 400; letter-spacing: 0.5px; text-transform: uppercase; }

.sidebar-section { padding: 16px 12px 8px; }
.sidebar-label {
  font-size: 10px; color: var(--muted2); text-transform: uppercase;
  letter-spacing: 1px; font-weight: 500; padding: 0 8px; margin-bottom: 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13.5px; color: var(--muted); font-weight: 400;
  transition: all 0.15s; border: 1px solid transparent;
  user-select: none;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active {
  background: rgba(245, 200, 66, 0.1);
  border-color: rgba(245, 200, 66, 0.2);
  color: var(--yellow);
}
.nav-icon { width: 16px; height: 16px; opacity: 0.7; flex-shrink: 0; }
.nav-item.active .nav-icon { opacity: 1; }

.bot-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13px; color: var(--muted); transition: all 0.15s;
  border: 1px solid transparent; user-select: none;
}
.bot-item:hover { background: var(--bg3); color: var(--text); }
.bot-item.active { background: var(--bg3); color: var(--text); border-color: var(--border); }

.bot-avatar {
  width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.bot-info { flex: 1; min-width: 0; }
.bot-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-role { font-size: 11px; color: var(--muted); }

.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success); flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto; padding: 12px;
  border-top: 1px solid var(--border);
}
.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; background: var(--bg3); cursor: pointer;
}
.user-avatar {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--blue2); display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 600;
}
.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--muted); }

.sidebar-bots { overflow-y: auto; flex: 1; }
.sidebar-bots::-webkit-scrollbar { width: 3px; }
.sidebar-bots::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── MAIN ── */
.main {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg);
}

/* ── TOP BAR ── */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.topbar-bot { display: flex; align-items: center; gap: 10px; flex: 1; }
.active-bot-avatar {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.active-bot-name { font-size: 15px; font-weight: 600; }
.active-bot-role { font-size: 12px; color: var(--muted); }

.topbar-actions { display: flex; gap: 8px; }
.btn {
  padding: 7px 14px; border-radius: 7px; font-size: 13px;
  font-family: var(--font); font-weight: 500; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg3);
  color: var(--text); transition: all 0.15s;
}
.btn:hover { border-color: var(--muted2); background: var(--bg); }
.btn-primary { background: var(--yellow); color: #000; border-color: var(--yellow); }
.btn-primary:hover { background: var(--yellow2); border-color: var(--yellow2); }

/* ── CHAT AREA ── */
.chat-area {
  flex: 1; overflow-y: auto; padding: 24px;
  display: flex; flex-direction: column; gap: 20px;
  scroll-behavior: smooth;
}
.chat-area::-webkit-scrollbar { width: 4px; }
.chat-area::-webkit-scrollbar-track { background: transparent; }
.chat-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.msg { display: flex; gap: 12px; max-width: 720px; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }

.msg-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0; margin-top: 2px;
}
.msg.user .msg-avatar { background: var(--blue2); font-size: 12px; font-weight: 600; }

.msg-body { display: flex; flex-direction: column; gap: 4px; }
.msg-meta {
  font-size: 11px; color: var(--muted); display: flex; gap: 8px; align-items: center;
}
.msg.user .msg-meta { justify-content: flex-end; }
.msg-sender { font-weight: 500; }

.msg-tools {
  display: flex; align-items: center; gap: 6px; margin-left: auto;
}

.color-pick {
  width: 18px; height: 18px; padding: 0; border: 1px solid var(--border);
  border-radius: 4px; cursor: pointer; background: none;
  -webkit-appearance: none; appearance: none;
}
.color-pick::-webkit-color-swatch-wrapper { padding: 1px; }
.color-pick::-webkit-color-swatch { border: none; border-radius: 2px; }
.color-pick::-moz-color-swatch { border: none; border-radius: 2px; }
.color-pick:hover { border-color: var(--yellow); }

.copy-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted2); padding: 2px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s;
}
.copy-btn:hover { color: var(--yellow); }

.msg-bubble {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px 12px 12px 3px;
  padding: 12px 16px; font-size: 14px; line-height: 1.6;
  color: var(--text); max-width: 600px;
}
.msg.user .msg-bubble {
  background: rgba(74, 140, 255, 0.12);
  border-color: rgba(74, 140, 255, 0.25);
  border-radius: 12px 12px 3px 12px;
}
.msg-bubble p { margin-bottom: 8px; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble strong { color: var(--yellow); font-weight: 500; }
.msg-bubble code {
  background: var(--bg3); border: 1px solid var(--border);
  padding: 1px 5px; border-radius: 4px;
  font-family: var(--mono); font-size: 12px; color: var(--blue);
}

.typing-indicator { display: flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted); animation: bounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ── QUICK PROMPTS ── */
.quick-prompts { padding: 0 24px 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.qp {
  padding: 6px 12px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--bg2);
  font-size: 12.5px; color: var(--muted); cursor: pointer;
  transition: all 0.15s; font-family: var(--font);
}
.qp:hover { border-color: var(--yellow); color: var(--yellow); background: rgba(245,200,66,0.06); }

/* ── INPUT AREA ── */
.input-area {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}
.input-wrap {
  display: flex; gap: 10px; align-items: flex-end;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px;
  transition: border-color 0.15s;
}
.input-wrap:focus-within { border-color: var(--yellow); }

#msg-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-family: var(--font); font-size: 14px;
  resize: none; max-height: 120px; line-height: 1.5;
  scrollbar-width: none;
}
#msg-input::placeholder { color: var(--muted2); }
#msg-input::-webkit-scrollbar { display: none; }

.send-btn {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--yellow); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.15s;
}
.send-btn:hover { background: var(--yellow2); }
.send-btn svg { width: 16px; height: 16px; }

/* ── IMAGE UPLOAD ── */
.attach-btn {
  width: 34px; height: 34px; border-radius: 8px;
  background: transparent; border: 1px solid var(--border); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.15s; color: var(--muted);
}
.attach-btn:hover { border-color: var(--yellow); color: var(--yellow); }

.img-preview-bar {
  display: none; gap: 8px; padding: 8px 0 4px;
  flex-wrap: wrap;
}
.img-preview-item {
  position: relative; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border);
}
.img-preview-item img {
  height: 64px; max-width: 120px; object-fit: cover; display: block;
}
.img-preview-remove {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,0.7); color: #fff; border: none;
  font-size: 12px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; line-height: 1;
}
.img-preview-remove:hover { background: #e53e3e; }

.chat-attached-img {
  max-width: 240px; max-height: 180px; border-radius: 8px;
  border: 1px solid var(--border); margin-bottom: 6px; display: block;
}

/* ── KNOWLEDGE BASE EDITOR ── */
.kb-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.kb-topbar-title { font-size: 16px; font-weight: 600; }
.kb-topbar-actions { display: flex; align-items: center; gap: 10px; }

.kb-editor-wrap {
  flex: 1; padding: 20px 24px;
  display: flex; flex-direction: column;
  min-height: 0;
}
.kb-help {
  font-size: 13px; color: var(--muted); line-height: 1.5;
  margin-bottom: 14px;
}
.kb-textarea {
  flex: 1; width: 100%;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text);
  font-family: var(--mono); font-size: 13px;
  padding: 16px 18px; line-height: 1.7;
  outline: none; resize: none;
  transition: border-color 0.15s;
}
.kb-textarea:focus { border-color: var(--yellow); }

.kb-save-status {
  font-size: 12px; font-weight: 500; min-width: 60px; text-align: right;
}
.kb-save-status.saved { color: var(--success); }
.kb-save-status.saving { color: var(--yellow); }
.kb-save-status.error { color: #e05555; }

/* ── WELCOME SCREEN ── */
.welcome {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; gap: 16px; text-align: center; padding: 40px;
}
.welcome-icon { font-size: 48px; margin-bottom: 8px; }
.welcome h2 { font-size: 22px; font-weight: 600; }
.welcome p { color: var(--muted); font-size: 14px; max-width: 380px; line-height: 1.6; }

.bot-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px;
  width: 100%; max-width: 660px; margin-top: 8px;
}
.bot-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; cursor: pointer;
  transition: all 0.15s; text-align: left;
  display: flex; align-items: center; gap: 10px;
}
.bot-card:hover { border-color: var(--yellow); background: rgba(245,200,66,0.04); }
.bot-card-name { font-size: 13px; font-weight: 500; }
.bot-card-role { font-size: 11px; color: var(--muted); }

.tokens-badge {
  font-size: 11px; color: var(--muted2); font-family: var(--mono);
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 7px;
}

/* ── IMAGE GENERATION ── */
.img-bubble { max-width: 520px !important; }
.gen-image {
  width: 100%; border-radius: 8px; cursor: pointer;
  margin-bottom: 10px; border: 1px solid var(--border);
  transition: opacity 0.15s;
}
.gen-image:hover { opacity: 0.9; }
.img-prompt-text {
  font-size: 12px; color: var(--muted); line-height: 1.5;
  margin-bottom: 10px; font-style: italic;
}
.img-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.btn-approve {
  background: var(--success) !important; color: #000 !important;
  border-color: var(--success) !important;
}
.btn-approve:hover { opacity: 0.85; }
.btn-revise {
  background: rgba(255,140,66,0.15) !important;
  border-color: rgba(255,140,66,0.4) !important;
  color: #ff8c42 !important;
}
.btn-revise:hover { background: rgba(255,140,66,0.25) !important; }

/* ── LIBRARY VIEW ── */
.library-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.library-title { font-size: 16px; font-weight: 600; }
.library-filters { display: flex; gap: 6px; }
.lib-filter {
  padding: 5px 12px; border-radius: 6px; font-size: 12px;
  font-family: var(--font); font-weight: 500; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg3);
  color: var(--muted); transition: all 0.15s;
}
.lib-filter:hover { border-color: var(--muted2); color: var(--text); }
.lib-filter.active { background: rgba(245,200,66,0.12); border-color: var(--yellow); color: var(--yellow); }

.library-grid {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 10px; align-content: start;
}
@media (max-width: 1100px) { .library-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px) { .library-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .library-grid { grid-template-columns: repeat(2, 1fr); } }

.library-empty {
  grid-column: 1 / -1;
  text-align: center; padding: 60px 20px;
  color: var(--muted); font-size: 14px;
}

.library-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; transition: border-color 0.15s;
}
.library-card:hover { border-color: var(--muted2); }

.library-card-img {
  width: 100%; aspect-ratio: 1/1; object-fit: cover;
  display: block; cursor: pointer; background: var(--bg3);
  transition: transform 0.15s;
}
.library-card-img:hover { opacity: 0.9; transform: scale(1.02); }

.library-card-body { padding: 8px 10px; }
.library-card-caption {
  font-size: 11px; color: var(--text); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 4px;
}

/* Lightbox */
.lib-lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.88); display: flex; align-items: center; justify-content: center;
  cursor: pointer; animation: lbFadeIn 0.15s ease;
}
@keyframes lbFadeIn { from { opacity: 0; } to { opacity: 1; } }
.lib-lightbox img {
  max-width: 90vw; max-height: 90vh; border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  cursor: default;
}
.lib-lightbox-close {
  position: absolute; top: 16px; right: 20px; color: #fff; font-size: 28px;
  cursor: pointer; background: none; border: none; opacity: 0.7;
}
.lib-lightbox-close:hover { opacity: 1; }
.library-card-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: var(--muted); margin-bottom: 8px;
}
.library-badge {
  padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.library-badge.approved { background: rgba(62,207,142,0.15); color: var(--success); }
.library-badge.pending { background: rgba(245,200,66,0.12); color: var(--yellow); }
.library-badge.rejected { background: rgba(224,85,85,0.15); color: #e05555; }

.library-card-actions {
  display: flex; align-items: center; gap: 6px;
  padding-top: 8px; border-top: 1px solid var(--border);
}

/* CRM Toggle Switch */
.crm-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted); cursor: pointer;
  user-select: none; flex: 1;
}
.crm-toggle-track {
  width: 28px; height: 16px; border-radius: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  position: relative; transition: all 0.2s; flex-shrink: 0;
}
.crm-toggle-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted2); transition: all 0.2s;
}
.crm-toggle.on .crm-toggle-track {
  background: rgba(62,207,142,0.2); border-color: var(--success);
}
.crm-toggle.on .crm-toggle-track::after {
  left: 14px; background: var(--success);
}

.lib-action-btn {
  padding: 4px 8px; border-radius: 5px; font-size: 11px;
  font-family: var(--font); cursor: pointer;
  border: 1px solid var(--border); background: var(--bg3);
  color: var(--muted); transition: all 0.15s; text-decoration: none;
}
.lib-action-btn:hover { border-color: var(--muted2); color: var(--text); }
.lib-action-btn.delete:hover { border-color: #e05555; color: #e05555; }

/* ── PROJECTS VIEW ── */
.projects-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-wrap: wrap;
}
.projects-title { font-size: 16px; font-weight: 600; }
.projects-branch-filters { display: flex; gap: 6px; margin-right: auto; }
.projects-filters { display: flex; gap: 6px; }

.branch-filter {
  padding: 5px 14px; border-radius: 6px; font-size: 12px;
  font-family: var(--font); font-weight: 500; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg3);
  color: var(--muted); transition: all 0.15s;
}
.branch-filter:hover { border-color: var(--muted2); color: var(--text); }
.branch-filter.active { background: rgba(245,200,66,0.12); border-color: var(--yellow); color: var(--yellow); }
.branch-filter[data-branch="B2B"].active { background: rgba(37,99,235,0.12); border-color: #2563eb; color: #2563eb; }
.branch-filter[data-branch="Teamsport"].active { background: rgba(245,158,11,0.12); border-color: #f59e0b; color: #f59e0b; }
.branch-filter[data-branch="Efterskole"].active { background: rgba(16,185,129,0.12); border-color: #10b981; color: #10b981; }

.pc-branch-badge {
  padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600;
  letter-spacing: 0.3px; flex-shrink: 0;
}

.projects-date-filter {
  display: flex; align-items: center; gap: 6px;
}
.pw-date {
  padding: 4px 8px !important; font-size: 11px !important;
  max-width: 140px; background: var(--bg3) !important;
}

.projects-ai-team {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg); overflow-x: auto;
}
.ai-team-label { font-size: 11px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.ai-team-cards { display: flex; gap: 8px; }
.ai-team-card {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px;
  background: var(--bg2); border: 1px solid var(--border);
  font-size: 12px; white-space: nowrap;
}
.ai-team-card strong { font-weight: 600; color: var(--text); }
.ai-team-spec { font-size: 10px; color: var(--muted); }

.projects-grid {
  flex: 1; overflow-y: auto; padding: 20px 24px;
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 16px; align-content: start;
}
@media (max-width: 900px) { .projects-grid { grid-template-columns: 1fr; } }

.project-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 20px;
  cursor: pointer; transition: all 0.15s;
  border-left: 4px solid var(--yellow);
  display: flex; flex-direction: column; gap: 10px;
}
.project-card:hover { border-color: var(--yellow); background: rgba(245,200,66,0.04); }
.project-card.status-aktiv   { border-left-color: var(--success); }
.project-card.status-planlagt { border-left-color: var(--blue); }
.project-card.status-afsluttet { border-left-color: var(--muted2); }

.pc-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pc-name { font-size: 15px; font-weight: 600; flex: 1; }
.pc-badge {
  padding: 3px 8px; border-radius: 5px; font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.pc-badge.aktiv   { background: rgba(62,207,142,0.15); color: var(--success); }
.pc-badge.planlagt { background: rgba(74,140,255,0.15); color: var(--blue); }
.pc-badge.afsluttet { background: rgba(80,85,95,0.3); color: var(--muted); }
.pc-badge.kladde { background: rgba(245,200,66,0.12); color: var(--yellow); }

.pc-meta { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.pc-meta span { display: flex; align-items: center; gap: 4px; }

.pc-channels { display: flex; gap: 6px; flex-wrap: wrap; }
.pc-channel-tag {
  padding: 2px 7px; border-radius: 4px; font-size: 10px;
  background: var(--bg3); border: 1px solid var(--border); color: var(--muted);
}
.pc-channel-tag.has-content { border-color: var(--success); color: var(--success); }

/* ── PROJECT WORKSPACE ── */
.pw-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.pw-back { flex-shrink: 0; }
.pw-title { font-size: 16px; font-weight: 600; flex: 1; }
.pw-status {
  font-size: 12px; padding: 3px 10px; border-radius: 5px;
  background: var(--bg3); color: var(--muted);
}
.pw-sync-bar {
  font-size: 11px; color: var(--muted); min-width: 120px; text-align: right;
}
.pw-sync-bar.saving { color: var(--yellow); }
.pw-sync-bar.saved { color: var(--success); }
.pw-sync-bar.pending { color: var(--muted2); }

.pw-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  background: var(--bg2); padding: 0 24px;
}
.pw-tab {
  padding: 10px 18px; font-size: 13px; font-weight: 500;
  font-family: var(--font); cursor: pointer;
  border: none; background: none; color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.pw-tab:hover { color: var(--text); }
.pw-tab.active { color: var(--yellow); border-bottom-color: var(--yellow); }

.pw-content {
  flex: 1; overflow-y: auto; padding: 24px;
  display: flex; flex-direction: column;
}
.pw-content.no-scroll { overflow: hidden; display: flex; flex-direction: column; }

.pw-editor-wrap {
  max-width: 720px;
  display: flex; flex-direction: column; gap: 16px;
}

.pw-field-label {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.8px; margin-bottom: 4px; font-weight: 500;
}

.pw-input {
  width: 100%; padding: 10px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-family: var(--font); font-size: 14px;
  outline: none; transition: border-color 0.15s;
}
.pw-input:focus { border-color: var(--yellow); }

.pw-textarea {
  width: 100%; min-height: 120px; padding: 12px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-family: var(--font); font-size: 14px;
  outline: none; resize: vertical; line-height: 1.6;
  transition: border-color 0.15s;
}
.pw-textarea:focus { border-color: var(--yellow); }

.pw-toolbar {
  display: flex; gap: 4px; margin-bottom: 4px;
}
.pw-tb-btn {
  padding: 4px 10px; border-radius: 5px;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; cursor: pointer;
  font-family: var(--font); transition: all 0.12s;
}
.pw-tb-btn:hover { background: var(--border); border-color: var(--muted2); }

.pw-richtext {
  width: 100%; min-height: 200px; padding: 16px;
  background: #e8eaed; border: 1px solid var(--border);
  border-radius: 0 0 8px 8px; color: #1a1a1a;
  font-family: var(--font); font-size: 14px;
  outline: none; line-height: 1.7;
  overflow-y: auto;
}
.pw-richtext img {
  max-width: 100%; border-radius: 6px; margin: 8px 0; display: block;
}
.pw-richtext:focus { border-color: var(--yellow); }

/* ── Email image resize handles ── */
.eimg-wrap {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
  user-select: none;
}
.eimg-handle-br {
  position: absolute; bottom: -5px; right: -5px;
  width: 12px; height: 12px;
  background: var(--yellow); border: 2px solid #fff;
  border-radius: 2px; cursor: nwse-resize; z-index: 5;
}
.eimg-handle-br:hover { background: var(--yellow2); transform: scale(1.2); }
.eimg-del-btn {
  position: absolute; top: -8px; right: -8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #e05555; color: #fff; border: 2px solid #fff;
  font-size: 11px; line-height: 1;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center; z-index: 5;
  transition: background 0.15s;
}
.eimg-del-btn:hover { background: #c53030; }
.eimg-size-label {
  position: absolute; bottom: -20px; left: 0;
  font-size: 10px; color: var(--yellow);
  font-family: var(--mono); font-weight: 500;
  background: rgba(0,0,0,0.7); padding: 1px 6px;
  border-radius: 3px; pointer-events: none;
}
.pw-richtext:empty::before {
  content: attr(data-placeholder);
  color: var(--muted2);
}

.pw-select {
  padding: 8px 12px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-family: var(--font); font-size: 13px;
  outline: none; cursor: pointer;
}
.pw-select:focus { border-color: var(--yellow); }

.pw-actions {
  display: flex; gap: 8px; align-items: center;
  padding-top: 12px; border-top: 1px solid var(--border);
}

.pw-banner-preview {
  width: 100%; max-height: 200px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border);
  margin-top: 4px;
}

.pw-img-upload-area {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.pw-images-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.pw-img-card {
  position: relative; cursor: pointer; border-radius: 8px;
  border: 2px solid transparent; overflow: hidden;
  transition: border-color 0.15s;
}
.pw-img-card:hover { border-color: var(--blue); }
.pw-img-card.active-banner { border-color: var(--yellow); }
.pw-img-card img {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
}
.pw-img-badge {
  position: absolute; bottom: 6px; left: 6px;
  background: var(--yellow); color: #000; font-size: 10px;
  font-weight: 600; padding: 2px 8px; border-radius: 4px;
}
.pw-empty {
  text-align: center; padding: 40px 20px;
  color: var(--muted); font-size: 14px;
}

/* ── PROJECT CHAT ── */
.pw-chat-wrap {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0; overflow: hidden;
  height: 100%;
}
.pw-chat-bot-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 0 14px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap; flex-shrink: 0;
}
.pw-chat-bot-list { display: flex; gap: 6px; flex-wrap: wrap; }
.pw-chat-bot-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 7px; font-size: 12px;
  font-family: var(--font); font-weight: 500; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg3);
  color: var(--muted); transition: all 0.15s;
}
.pw-chat-bot-btn:hover { border-color: var(--muted2); color: var(--text); }
.pw-chat-bot-btn.active { background: var(--bg); }

.pw-chat-area {
  flex: 1; overflow-y: auto; padding: 16px 0;
  display: flex; flex-direction: column; gap: 16px;
  scroll-behavior: smooth;
  min-height: 0;
}
.pw-chat-area::-webkit-scrollbar { width: 4px; }
.pw-chat-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.pw-chat-input-area {
  padding-top: 12px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.pw-chat-input-area .input-wrap {
  width: 100%;
}
.pw-chat-input-area textarea {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-family: var(--font); font-size: 14px;
  resize: none; max-height: 120px; line-height: 1.5;
  width: 100%; min-width: 0;
}
.pw-chat-input-area textarea::placeholder { color: var(--muted2); }

/* ── SAVE TO CHANNEL BUTTONS ── */
.pw-save-to-channel {
  display: flex; align-items: center; gap: 5px;
  margin-top: 6px; flex-wrap: wrap;
}
.pw-stc-label {
  font-size: 10px; color: var(--muted2);
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500;
  margin-right: 2px;
}
.pw-stc-btn {
  padding: 3px 10px; border-radius: 4px; font-size: 11px;
  font-family: var(--font); font-weight: 500; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg3);
  color: var(--muted); transition: all 0.15s;
}
.pw-stc-btn:hover { border-color: var(--yellow); color: var(--yellow); background: rgba(245,200,66,0.06); }
.pw-stc-email { border-color: rgba(74,140,255,0.3); color: var(--blue); }
.pw-stc-email:hover { border-color: var(--blue); background: rgba(74,140,255,0.08); }
.pw-stc-saved {
  font-size: 11px; color: var(--success); font-weight: 500;
}

/* ── PROJECT BRIEF ── */
.pw-brief-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 12px;
}
.pw-brief-textarea {
  min-height: 400px; font-size: 14px; line-height: 1.7;
  white-space: pre-wrap;
}

/* ── VIEW SWITCHER ── */
.projects-view-switch { display: flex; gap: 4px; }
.pv-btn {
  padding: 5px 14px; border-radius: 6px; font-size: 12px;
  font-family: var(--font); font-weight: 500; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg3);
  color: var(--muted); transition: all 0.15s;
}
.pv-btn:hover { border-color: var(--muted2); color: var(--text); }
.pv-btn.active { background: rgba(245,200,66,0.12); border-color: var(--yellow); color: var(--yellow); }

/* ── GANTT VIEW ── */
.gantt-wrap {
  grid-column: 1 / -1;
  overflow-x: auto;
  min-width: 0;
}
.gantt-header {
  display: grid;
  grid-template-columns: 140px repeat(12, 1fr);
  background: var(--bg2);
  border-bottom: 2px solid var(--border);
  position: sticky; top: 0; z-index: 2;
}
.gantt-label-col {
  padding: 10px 12px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  border-right: 1px solid var(--border);
}
.gantt-month {
  padding: 10px 4px;
  font-size: 11px; font-weight: 500; color: var(--muted);
  text-align: center;
  border-right: 1px solid var(--border);
}
.gantt-month.current {
  background: rgba(245,200,66,0.1);
  color: var(--yellow); font-weight: 600;
}
.gantt-body { position: relative; }
.gantt-today-line {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: #e05555; z-index: 1; pointer-events: none;
}
.gantt-row {
  display: flex;
  border-bottom: 1px solid var(--border);
  min-height: 42px;
}
.gantt-row:hover { background: rgba(255,255,255,0.02); }
.gantt-campaign-info {
  width: 140px; min-width: 140px;
  padding: 8px 10px;
  display: flex; flex-direction: column; gap: 2px;
  justify-content: center;
  border-right: 1px solid var(--border);
  cursor: pointer;
}
.gantt-campaign-info:hover { background: var(--bg3); }
.gantt-camp-name {
  font-size: 12px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gantt-track {
  flex: 1; position: relative;
  min-height: 36px;
}
.gantt-bar {
  position: absolute; top: 6px; height: 26px;
  border-radius: 5px; padding: 0 8px;
  font-size: 11px; font-weight: 500; color: #fff;
  display: flex; align-items: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; transition: opacity 0.15s;
  z-index: 1;
}
.gantt-bar:hover { opacity: 0.85; }
.gantt-deadline {
  position: absolute; top: 2px; bottom: 2px; width: 2px;
  background: #e05555; z-index: 2;
}
.gantt-deadline::before {
  content: ''; position: absolute; top: -2px; left: -3px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #e05555;
}

/* ── CALENDAR VIEW ── */
.cal-wrap {
  grid-column: 1 / -1;
  padding: 0;
}
.cal-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; padding: 12px 0 16px;
}
.cal-nav-label {
  font-size: 16px; font-weight: 600; min-width: 180px;
  text-align: center;
}
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden;
}
.cal-day-header {
  background: var(--bg2); padding: 8px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-align: center; text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cal-day {
  background: var(--bg);
  min-height: 90px; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.cal-day:hover { background: var(--bg2); }
.cal-day.today {
  background: rgba(245,200,66,0.06);
  box-shadow: inset 0 0 0 2px var(--yellow);
}
.cal-day.other-month {
  background: var(--bg2);
  opacity: 0.4;
}
.cal-day-num {
  font-size: 12px; font-weight: 500; color: var(--muted);
  margin-bottom: 2px;
}
.cal-day.today .cal-day-num { color: var(--yellow); font-weight: 700; }
.cal-event {
  font-size: 10px; padding: 2px 5px;
  border-radius: 3px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-weight: 500; transition: opacity 0.15s;
}
.cal-event:hover { opacity: 0.8; }
.cal-more {
  font-size: 10px; color: var(--muted); font-style: italic;
  background: none !important; border: none !important;
}
.cal-deadline {
  background: rgba(224,85,85,0.15) !important;
  color: #e05555 !important;
  border-left: 2px solid #e05555 !important;
  font-weight: 600;
}

/* ── LIBRARY PICKER MODAL ── */
.bib-picker-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9000;
  display: flex; align-items: center; justify-content: center;
}
.bib-picker-modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%; max-width: 700px; max-height: 80vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.bib-picker-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 600;
}
.bib-picker-grid {
  flex: 1; overflow-y: auto; padding: 16px;
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; align-content: start;
}
.bib-picker-img {
  cursor: pointer; border-radius: 8px;
  border: 2px solid transparent;
  overflow: hidden; transition: border-color 0.15s;
  background: var(--bg3);
}
.bib-picker-img:hover { border-color: var(--yellow); }
.bib-picker-img img {
  width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block;
}
.bib-picker-caption {
  padding: 6px 8px; font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
