
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Dark theme (default) */
  --bg:      #0d1117;
  --bg1:     #111a1f;
  --bg2:     #162025;
  --bg3:     #1a272e;
  --bg4:     #1f3038;
  --border:  rgba(255,255,255,0.055);
  --border2: rgba(255,255,255,0.09);
  --border3: rgba(255,255,255,0.13);
  --text:    #e2eaf0;
  --text2:   #8fa6b2;
  --muted:   #4d6470;
  --primary:        #2dd4bf;
  --primary2:       #5eead4;
  --primary-bg:     rgba(45,212,191,0.08);
  --primary-border: rgba(45,212,191,0.22);
  --cyan:    #38bdf8;
  --green:   #34d399;
  --yellow:  #fbbf24;
  --red:     #f87171;
  --orange:  #fb923c;
  --purple:  #a78bfa;
  --pink:    #f472b6;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --shadow-primary: none;
  --r-sm: 7px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px;
}

/* ── LIGHT MODE ── */
body.light-mode {
  --bg:      #f8fafc;
  --bg1:     #f1f5f9;
  --bg2:     #e9eef4;
  --bg3:     #dde4ec;
  --bg4:     #cfd7e2;
  --border:  rgba(0,0,0,0.08);
  --border2: rgba(0,0,0,0.12);
  --border3: rgba(0,0,0,0.16);
  --text:    #0f172a;
  --text2:   #475569;
  --muted:   #94a3b8;
  --primary:        #0d9488;
  --primary2:       #0f766e;
  --primary-bg:     rgba(13,148,136,0.08);
  --primary-border: rgba(13,148,136,0.25);
  --cyan:    #0284c7;
  --green:   #16a34a;
  --yellow:  #d97706;
  --red:     #dc2626;
  --orange:  #ea580c;
  --purple:  #7c3aed;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  height: 100vh;
  display: flex;
  overflow: hidden;
  font-size: 13.5px;
  line-height: 1.5;
}

/* no texture overlay — clean flat dark */

/* ══ SIDEBAR — Nebula flat style ══ */
.sidebar {
  width: 220px;
  background: var(--bg1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar { width: 0; }

.sidebar-logo {
  padding: 14px 12px 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.logo-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 9px;
}

.logo-text::before {
  content: '⬡';
  font-size: 18px;
  color: var(--primary);
  display: block;
  flex-shrink: 0;
}

.logo-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  margin-top: 3px;
  letter-spacing: 0.08em;
  padding-left: 30px;
}

/* Kill switch */
.kill-btn {
  margin: 10px 10px 4px;
  padding: 6px 11px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(248,113,113,0.18);
  background: rgba(248,113,113,0.04);
  color: var(--red);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s;
}
.kill-btn:hover { background: rgba(248,113,113,0.1); border-color: rgba(248,113,113,0.3); }
.kill-btn.killed { background: rgba(248,113,113,0.15); border-color: var(--red); animation: pulse-red 1.5s ease-in-out infinite; }
@keyframes pulse-red { 0%,100%{ box-shadow: 0 0 0 0 rgba(248,113,113,0.3); } 50%{ box-shadow: 0 0 0 6px rgba(248,113,113,0); } }
.kill-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.kill-btn.killed .kill-dot { animation: blink .8s step-end infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* Nav sections */
.nav-section {
  padding: 18px 14px 5px;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 11px;
  margin: 1px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 400;
  color: var(--text2);
  transition: all 0.12s;
  position: relative;
}

.nav-item:hover {
  background: var(--bg2);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 500;
  border: none;
}

.nav-icon {
  font-size: 13px;
  width: 17px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: rgba(45,212,191,0.15);
  color: var(--primary);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-bottom {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.sys-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text2);
}

.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: var(--green); box-shadow: 0 0 6px var(--green); animation: pdot 2.5s ease-in-out infinite; }
.dot-yellow { background: var(--yellow); }
.dot-red { background: var(--red); box-shadow: 0 0 6px var(--red); }
.dot-gray { background: var(--muted); }
@keyframes pdot { 0%,100%{opacity:1;transform:scale(1);} 50%{opacity:.55;transform:scale(.82);} }

/* ══ MAIN AREA ══ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.topbar {
  height: 50px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  flex-shrink: 0;
  background: var(--bg1);
}

.topbar-title {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
  color: var(--text);
}

.topbar-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
}

.ping-btn {
  padding: 6px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--primary-border);
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}
.ping-btn:hover { background: rgba(45,212,191,0.14); }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}
.content::-webkit-scrollbar { width: 4px; }
.content::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 4px; }

.screen { display: none; }
.screen.active { display: block; }

/* ══ CARDS ══ */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 20px;
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}

/* Layout grids */
.g4{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;}
.g3{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;}
.g2{display:grid;grid-template-columns:1fr 1fr;gap:14px;}
.g4>*,.g3>*,.g2>*{min-width:0;}
.mb16{margin-bottom:16px;} .mb20{margin-bottom:20px;} .mb24{margin-bottom:24px;}
.flex-row{display:flex;align-items:center;gap:10px;}
.ml-auto{margin-left:auto;}

.sec-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}
.sec-sub { font-size: 12px; color: var(--text2); margin-bottom: 20px; }

/* Buttons */
.btn-sm {
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text2);
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}
.btn-sm:hover { border-color: var(--primary-border); color: var(--primary); }
.int-tool-row { display:flex; align-items:center; gap:14px; padding:13px 18px; background:var(--bg2); border-bottom:1px solid var(--border); }
.int-tool-icon { width:36px; height:36px; border-radius:8px; background:var(--bg3); display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; }
.int-tool-body { flex:1; }
.int-tool-name { font-size:13px; font-weight:500; margin-bottom:2px; }
.int-tool-desc { font-size:11px; color:var(--text2); }
.int-auth-tag { font-size:10px; padding:2px 8px; border-radius:5px; background:var(--bg3); color:var(--muted); border:1px solid var(--border2); white-space:nowrap; }
.int-status { font-size:11px; color:var(--muted); white-space:nowrap; }

.modal-btn {
  padding: 8px 16px;
  border-radius: var(--r-sm);
  border: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}

.btn-primary {
  background: var(--primary);
  color: #0d1117;
  font-weight: 600;
}
.btn-primary:hover { background: var(--primary2); transform: translateY(-1px); }

.btn-danger { background: var(--red); color: #fff; }
.btn-ghost {
  background: var(--bg3);
  color: var(--text2);
  border: 1px solid var(--border2);
}
.modal-btn:hover:not(.btn-primary) { opacity: 0.85; }

/* Status tags */
.stag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.s-active  { background: rgba(52,211,153,0.1); color: var(--green); border: 1px solid rgba(52,211,153,0.18); }
.s-done    { background: rgba(45,212,191,0.1); color: var(--primary); border: 1px solid rgba(45,212,191,0.18); }
.s-pending { background: rgba(251,191,36,0.1); color: var(--yellow); border: 1px solid rgba(251,191,36,0.18); }
.s-error   { background: rgba(248,113,113,0.1); color: var(--red); border: 1px solid rgba(248,113,113,0.18); }
.s-idle    { background: rgba(77,100,112,0.15); color: var(--muted); border: 1px solid rgba(77,100,112,0.18); }

/* Priority tags */
.p-urgent  { background: rgba(248,113,113,0.1); color: var(--red); border: 1px solid rgba(248,113,113,0.18); }
.p-high    { background: rgba(251,146,60,0.1); color: var(--orange); border: 1px solid rgba(251,146,60,0.18); }
.p-medium  { background: rgba(251,191,36,0.1); color: var(--yellow); border: 1px solid rgba(251,191,36,0.18); }
.p-low     { background: rgba(77,100,112,0.15); color: var(--muted); border: 1px solid rgba(77,100,112,0.18); }
.tag-me    { background: rgba(167,139,250,0.1); color: var(--purple); border: 1px solid rgba(167,139,250,0.18); }
.tag-date  { background: var(--bg4); color: var(--text2); border: 1px solid var(--border2); }
.tag-agent { background: rgba(45,212,191,0.1); color: var(--primary); border: 1px solid rgba(45,212,191,0.18); }

/* ══ METRIC CARDS ══ */
.metric-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}
.metric-card:hover { border-color: var(--border2); }
.metric-card::after { display: none; }
.mc-c, .mc-g, .mc-y, .mc-p { border-top: none; }

.metric-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 10px;
}
.metric-value {
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 5px;
  color: var(--text);
}
.metric-sub { font-size: 11px; color: var(--text2); }

/* ══ ACTIVITY FEED ══ */
.feed-item {
  display: flex;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.feed-item:last-child { border-bottom: none; }
.feed-av {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  font-weight: 900;
}
.feed-body { flex: 1; }
.feed-agent { font-size: 12px; font-weight: 700; margin-bottom: 2px; }
.feed-text { font-size: 12px; color: var(--text2); line-height: 1.5; }
.feed-time { font-family: 'JetBrains Mono', monospace; font-size: 9px; color: var(--muted); margin-top: 3px; }

/* ══ KANBAN ══ */
.kb-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 16px;
  cursor: grab;
}
.kb-board:active { cursor: grabbing; }
.kb-board::-webkit-scrollbar { height: 18px; }
.kb-board::-webkit-scrollbar-track { background: var(--bg2); border-radius: 8px; border: 1px solid var(--border); margin: 0 2px; }
.kb-board::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 8px; border: 3px solid var(--bg2); min-width: 60px; }
.kb-board::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.kb-col {
  min-width: 165px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  flex-shrink: 0;
}
.kb-col.drag-over { border-color: var(--primary-border); background: var(--primary-bg); }

.kb-col-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.col-count {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  background: var(--bg4);
  padding: 2px 7px;
  border-radius: 10px;
  color: var(--muted);
}

.col-add {
  width: 100%;
  padding: 7px;
  border-radius: 7px;
  border: 1px dashed var(--border2);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.15s;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.col-add:hover { border-color: var(--primary-border); color: var(--primary2); }

/* Task cards */
.task-card {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 7px;
  cursor: grab;
  transition: all 0.15s;
  position: relative;
  user-select: none;
}
.task-card:active { cursor: grabbing; }
.task-card:hover { border-color: var(--border2); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.task-card.dragging { opacity: 0.45; transform: rotate(1.5deg); }

.task-card::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
}
.tc-urgent::before { background: var(--red); }
.tc-high::before   { background: var(--orange); }
.tc-medium::before { background: var(--yellow); }
.tc-low::before    { background: var(--muted); }

.task-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 7px;
  line-height: 1.45;
  padding-left: 10px;
  color: var(--text);
}
.task-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding-left: 10px;
}
.assign-ovr {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  font-size: 10px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s;
  padding-left: 10px;
}
.assign-ovr:hover { color: var(--primary2); }

/* Content pipeline cards */
.content-card {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 7px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.content-card:hover { border-color: var(--border2); transform: translateY(-1px); }
.content-card.dragging { opacity: 0.45; transform: rotate(1.5deg); }
.cc-title { font-size: 12px; font-weight: 600; margin-bottom: 6px; line-height: 1.45; color: var(--text); }
.cc-meta { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 5px; }
.cc-actions { display: flex; gap: 4px; margin-top: 6px; }
.cc-btn {
  padding: 3px 9px;
  border-radius: 5px;
  border: 1px solid var(--border2);
  background: var(--bg2);
  color: var(--text2);
  font-size: 10px;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: all 0.15s;
}
.cc-btn:hover { border-color: var(--primary-border); color: var(--primary2); }

/* Weekly schedule */
.week-schedule { display: grid; grid-template-columns: repeat(5,1fr); gap: 10px; margin-bottom: 22px; }
.week-day { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 12px; }
.wd-name { font-family: 'JetBrains Mono', monospace; font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px; }
.wd-theme { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.wd-items { display: flex; flex-direction: column; gap: 4px; }
.wd-item { font-size: 11px; padding: 4px 8px; border-radius: 6px; color: var(--text2); background: var(--bg3); }

/* ══ AGENTS / ORG CHART ══ */
.org-chart { display: flex; flex-direction: column; align-items: center; gap: 0; }
.org-level { display: flex; justify-content: center; gap: 16px; position: relative; }
.org-connector { width: 100%; display: flex; justify-content: center; position: relative; height: 30px; }
.org-connector-line { position: absolute; top: 0; height: 1px; background: var(--border2); }
.org-connector-down { position: absolute; top: 0; width: 2px; background: linear-gradient(to bottom, transparent, var(--primary)); height: 30px; }

.agent-org-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  width: 175px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  text-align: center;
}
.agent-org-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.agent-org-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.agent-av {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin: 0 auto 10px;
}
.agent-name-big { font-size: 15px; font-weight: 800; margin-bottom: 2px; letter-spacing: -0.01em; }
.agent-role-sm { font-size: 10px; color: var(--text2); margin-bottom: 8px; line-height: 1.5; }
.agent-status-row { display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 10px; margin-bottom: 6px; }
.agent-current { font-family: 'JetBrains Mono', monospace; font-size: 9px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 8px; margin-top: 2px; line-height: 1.5; }

/* Agent theme overrides */
.ao-ferris::before { background: linear-gradient(90deg, var(--primary), var(--cyan)); }
.ao-ferris .agent-av { background: rgba(45,212,191,0.1); color: var(--primary); }
.ao-ferris .agent-name-big { color: var(--primary); }
.ao-ferris:hover { border-color: var(--primary-border); box-shadow: 0 8px 30px rgba(45,212,191,0.1); }

.ao-finch::before { background: var(--purple); }
.ao-finch .agent-av { background: rgba(167,139,250,0.12); color: var(--purple); }
.ao-finch .agent-name-big { color: var(--purple); }
.ao-finch:hover { border-color: rgba(167,139,250,0.3); box-shadow: 0 8px 30px rgba(167,139,250,0.12); }

.ao-rusty::before { background: var(--orange); }
.ao-rusty .agent-av { background: rgba(251,146,60,0.12); color: var(--orange); }
.ao-rusty .agent-name-big { color: var(--orange); }
.ao-rusty:hover { border-color: rgba(251,146,60,0.3); box-shadow: 0 8px 30px rgba(251,146,60,0.12); }

.ao-doc::before { background: var(--green); }
.ao-doc .agent-av { background: rgba(52,211,153,0.12); color: var(--green); }
.ao-doc .agent-name-big { color: var(--green); }
.ao-doc:hover { border-color: rgba(52,211,153,0.3); box-shadow: 0 8px 30px rgba(52,211,153,0.12); }

.ao-sparky::before { background: var(--yellow); }
.ao-sparky .agent-av { background: rgba(251,191,36,0.12); color: var(--yellow); }
.ao-sparky .agent-name-big { color: var(--yellow); }
.ao-sparky:hover { border-color: rgba(251,191,36,0.3); box-shadow: 0 8px 30px rgba(251,191,36,0.12); }

/* Perf metrics */
.perf-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 12px; }
.perf-item { background: var(--bg3); border-radius: var(--r-sm); padding: 10px; text-align: center; }
.perf-num { font-size: 20px; font-weight: 800; margin-bottom: 2px; letter-spacing: -0.01em; }
.perf-lbl { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.mini-bar { height: 3px; border-radius: 3px; background: var(--bg4); margin-top: 8px; overflow: hidden; }
.mini-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }

/* ══ CALENDAR ══ */
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 5px; }
.cal-dh { text-align: center; font-family: 'JetBrains Mono', monospace; font-size: 9px; text-transform: uppercase; color: var(--muted); padding: 6px 0; letter-spacing: 0.1em; }
.cal-day { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px; min-height: 84px; cursor: pointer; transition: border-color 0.15s; }
.cal-day:hover { border-color: var(--border2); }
.cal-day.today { border-color: var(--primary-border); background: var(--primary-bg); }
.cal-day.other { opacity: 0.3; }
.cal-num { font-size: 11px; font-weight: 600; margin-bottom: 4px; }
.cal-day.today .cal-num { color: var(--primary); }
.cal-ev { font-size: 9px; padding: 2px 6px; border-radius: 4px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.ce-b  { background: rgba(56,189,248,0.22);  color: #7dd3fc; border-left: 2px solid #38bdf8; }
.ce-g  { background: rgba(52,211,153,0.22);  color: #6ee7b7; border-left: 2px solid #34d399; }
.ce-p  { background: rgba(139,92,246,0.22);  color: #c4b5fd; border-left: 2px solid #8b5cf6; }
.ce-gr { background: rgba(45,212,191,0.18);  color: #5eead4; border-left: 2px solid #2dd4bf; }
.ce-or { background: rgba(251,146,60,0.22);  color: #fdba74; border-left: 2px solid #fb923c; }
.ce-ye { background: rgba(250,204,21,0.18);  color: #fde047; border-left: 2px solid #facc15; }

/* ══ MEMORY ══ */
.mem-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; margin-bottom: 9px; cursor: pointer; transition: all 0.15s; }
.mem-card:hover { border-color: var(--border2); transform: translateY(-1px); }
.mem-title { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.mem-meta { display: flex; gap: 10px; font-size: 10px; color: var(--muted); margin-bottom: 6px; font-family: 'JetBrains Mono', monospace; }
.mem-preview { font-size: 11px; color: var(--text2); line-height: 1.6; }

/* ══ CONTACTS ══ */
.contact-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; transition: all 0.15s; cursor: pointer; }
.contact-card:hover { border-color: var(--border2); transform: translateY(-1px); }
.contact-name { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.contact-role { font-size: 11px; color: var(--text2); margin-bottom: 8px; }
.contact-det { font-size: 10px; color: var(--muted); font-family: 'JetBrains Mono', monospace; display: flex; align-items: center; gap: 5px; margin-bottom: 3px; }

/* ══ CHAT ══ */
.chat-agent-row { display: flex; gap: 7px; margin-bottom: 16px; flex-wrap: wrap; }

.chat-abt {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  background: var(--bg2);
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Plus Jakarta Sans', sans-serif;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-abt.sel {
  border-color: var(--primary-border);
  color: var(--primary2);
  background: var(--primary-bg);
}

.chat-messages { flex: 1; overflow-y: auto; padding: 4px 0; margin-bottom: 14px; }
.chat-messages::-webkit-scrollbar { width: 3px; }

.chat-msg { display: flex; gap: 10px; margin-bottom: 16px; align-items: flex-start; }
.chat-msg.user { flex-direction: row-reverse; }

.chat-bubble {
  max-width: 70%;
  padding: 11px 15px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.65;
}
.chat-msg.agent .chat-bubble {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px 14px 14px 14px;
  color: var(--text);
}
.chat-msg.user .chat-bubble {
  background: var(--primary);
  color: #0d1117;
  border-radius: 14px 4px 14px 14px;
  font-weight: 500;
}

.chat-who { font-size: 10px; font-weight: 700; color: var(--muted); margin-bottom: 3px; font-family: 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: 0.06em; }

.chat-input-row { display: flex; gap: 9px; }
.chat-in {
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  padding: 11px 15px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.chat-in:focus { border-color: var(--primary-border); }

.chat-send {
  padding: 11px 18px;
  border-radius: var(--r-md);
  border: none;
  background: var(--primary);
  color: #0d1117;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}
.chat-send:hover { background: var(--primary2); }

/* ══ SETTINGS ══ */
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 13px; font-weight: 600; }
.setting-sub { font-size: 11px; color: var(--text2); margin-top: 2px; }

.toggle { width: 38px; height: 21px; border-radius: 11px; background: var(--bg4); cursor: pointer; position: relative; transition: background 0.2s; border: 1px solid var(--border2); }
.toggle.on { background: rgba(45,212,191,0.3); border-color: var(--primary-border); }
.toggle::after { content: ''; position: absolute; width: 15px; height: 15px; border-radius: 50%; background: var(--muted); top: 2px; left: 2px; transition: all 0.2s; }
.toggle.on::after { left: 19px; background: var(--primary); }

.int-chip { display: flex; align-items: center; gap: 10px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 14px; margin-bottom: 7px; }
.int-name { font-size: 13px; font-weight: 600; flex: 1; }
.int-s { font-size: 9px; font-family: 'JetBrains Mono', monospace; padding: 2px 8px; border-radius: 4px; text-transform: uppercase; }
.int-on { background: rgba(52,211,153,0.12); color: var(--green); }
.int-off { background: rgba(92,104,128,0.12); color: var(--muted); }

.cron-item { display: flex; align-items: center; gap: 10px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 14px; margin-bottom: 7px; }
.cron-sch { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--primary); min-width: 130px; }
.cron-lbl { font-size: 12px; font-weight: 600; flex: 1; }

.modal-in {
  width: 100%;
  background: var(--bg1);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  outline: none;
  margin-bottom: 9px;
  transition: border-color 0.15s;
}
.modal-in:focus { border-color: var(--primary-border); box-shadow: 0 0 0 3px rgba(124,106,245,0.08); }
.modal-lbl { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; display: block; }

/* Rich text editor */
.rte-toolbar { display: flex; gap: 4px; padding: 7px 9px; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r-sm) var(--r-sm) 0 0; flex-wrap: wrap; }
.rte-btn { padding: 3px 7px; border-radius: 4px; border: none; background: transparent; color: var(--text2); font-size: 11px; cursor: pointer; font-family: 'Plus Jakarta Sans', sans-serif; transition: all 0.15s; }
.rte-btn:hover { background: var(--bg2); color: var(--text); }
.rte-content { min-height: 120px; background: var(--bg1); border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--r-sm) var(--r-sm); padding: 10px 12px; color: var(--text); font-size: 13px; line-height: 1.7; outline: none; }
.rte-content:focus { border-color: var(--primary-border); }

/* ══ MODAL ══ */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 1000; align-items: center; justify-content: center; backdrop-filter: blur(6px); }
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r-xl);
  padding: 24px;
  width: 520px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.2s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

.modal-title { font-size: 16px; font-weight: 800; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; letter-spacing: -0.01em; }
.modal-close { cursor: pointer; color: var(--muted); font-size: 17px; transition: color 0.15s; }
.modal-close:hover { color: var(--text); }
.modal-row { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; }

/* Attachment zone */
.attach-zone { border: 1px dashed var(--border2); border-radius: var(--r-sm); padding: 14px; text-align: center; cursor: pointer; transition: all 0.15s; margin-bottom: 9px; }
.attach-zone:hover { border-color: var(--primary-border); background: var(--primary-bg); }
.attach-zone p { font-size: 11px; color: var(--muted); }
.attach-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.attach-chip { font-size: 9px; padding: 3px 8px; border-radius: 5px; background: var(--bg3); border: 1px solid var(--border); color: var(--muted); font-family: 'JetBrains Mono', monospace; }

/* ══ SAAS / PHASE 6 ══ */
.phase-step { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; cursor: pointer; transition: all 0.2s; }
.phase-step:hover { border-color: var(--border2); transform: translateY(-1px); }
.phase-step.ps-done { border-color: rgba(52,211,153,0.2); background: rgba(52,211,153,0.04); }
.phase-step.ps-active { border-color: var(--primary-border); background: var(--primary-bg); }

.ps-num { width: 34px; height: 34px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.ps-done .ps-num { background: rgba(52,211,153,0.15); color: var(--green); }
.ps-active .ps-num { background: var(--primary-bg); color: var(--primary2); }
.ps-pending .ps-num { background: var(--bg3); color: var(--muted); }
.ps-title { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.ps-desc { font-size: 11px; color: var(--text2); line-height: 1.55; }
.ps-badge { margin-left: auto; font-size: 9px; padding: 3px 9px; border-radius: 5px; font-family: 'JetBrains Mono', monospace; font-weight: 700; flex-shrink: 0; }

/* Pricing tiers */
.tier-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px; position: relative; overflow: hidden; cursor: pointer; transition: all 0.2s; }
.tier-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.tier-card.tier-featured { border-color: var(--primary-border); }
.tier-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.tier-1::before { background: var(--green); }
.tier-2::before { background: linear-gradient(90deg, var(--primary), var(--cyan)); }
.tier-3::before { background: var(--purple); }
.tier-badge { position: absolute; top: 14px; right: 14px; font-size: 9px; padding: 3px 8px; border-radius: 5px; font-family: 'JetBrains Mono', monospace; font-weight: 700; text-transform: uppercase; }
.tier-name { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px; }
.tier-price { font-size: 32px; font-weight: 800; line-height: 1; margin-bottom: 4px; font-family: 'JetBrains Mono', monospace; letter-spacing: -0.02em; }
.tier-sub { font-size: 10px; color: var(--text2); margin-bottom: 16px; }
.tier-feature { display: flex; align-items: flex-start; gap: 8px; font-size: 11px; margin-bottom: 7px; line-height: 1.45; color: var(--text2); }
.tf-check { color: var(--green); font-size: 11px; flex-shrink: 0; margin-top: 1px; }
.tier-cta { width: 100%; padding: 11px; border-radius: var(--r-sm); border: none; font-size: 12px; font-weight: 700; cursor: pointer; margin-top: 14px; font-family: 'Plus Jakarta Sans', sans-serif; transition: all 0.15s; }
.tier-cta:hover { opacity: 0.88; transform: translateY(-1px); }

/* Affiliate tracker */
.aff-row { display: flex; align-items: center; gap: 13px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.aff-row:last-child { border-bottom: none; }
.aff-logo { width: 38px; height: 38px; border-radius: var(--r-sm); background: var(--bg3); display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; border: 1px solid var(--border); }
.aff-name { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.aff-cat { font-size: 10px; color: var(--text2); }
.aff-status { font-family: 'JetBrains Mono', monospace; font-size: 9px; padding: 2px 8px; border-radius: 20px; font-weight: 700; text-transform: uppercase; }
.aff-num { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 700; text-align: right; }
.aff-sub { font-size: 9px; color: var(--muted); text-align: right; }
.aff-bar { height: 3px; border-radius: 3px; background: var(--bg4); margin-top: 8px; overflow: hidden; }
.aff-bar-fill { height: 100%; border-radius: 3px; }

/* Wizard */
.wiz-step-bar { display: flex; gap: 3px; margin-bottom: 28px; }
.wiz-step-seg { flex: 1; height: 3px; border-radius: 3px; }
.wiz-panel { display: none; }
.wiz-panel.active { display: block; }
.wiz-field { margin-bottom: 14px; }
.wiz-field label { display: block; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 5px; }
.wiz-select { width: 100%; background: var(--bg1); border: 1px solid var(--border2); border-radius: var(--r-sm); padding: 9px 12px; color: var(--text); font-family: 'Inter', sans-serif; font-size: 13px; outline: none; transition: border-color 0.15s; }
.wiz-select:focus { border-color: var(--primary-border); }
.wiz-check-row { display: flex; align-items: center; gap: 10px; padding: 10px 13px; background: var(--bg1); border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 7px; cursor: pointer; transition: all 0.15s; }
.wiz-check-row:hover { border-color: var(--border2); }
.wiz-check-row.selected { border-color: var(--primary-border); background: var(--primary-bg); }
.wiz-check { width: 17px; height: 17px; border-radius: 5px; border: 1px solid var(--border2); background: var(--bg3); display: flex; align-items: center; justify-content: center; font-size: 10px; flex-shrink: 0; transition: all 0.15s; }
.wiz-check-row.selected .wiz-check { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Client management */
.client-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px; transition: all 0.15s; cursor: pointer; }
.client-card:hover { border-color: var(--border2); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.client-plan { font-size: 9px; font-family: 'JetBrains Mono', monospace; padding: 3px 8px; border-radius: 20px; font-weight: 700; text-transform: uppercase; }
.cp-t1 { background: rgba(52,211,153,0.12); color: var(--green); border: 1px solid rgba(52,211,153,0.2); }
.cp-t2 { background: var(--primary-bg); color: var(--primary2); border: 1px solid var(--primary-border); }
.cp-t3 { background: rgba(167,139,250,0.12); color: var(--purple); border: 1px solid rgba(167,139,250,0.2); }
.client-name { font-size: 16px; font-weight: 800; margin: 7px 0 2px; letter-spacing: -0.01em; }
.client-biz { font-size: 11px; color: var(--text2); margin-bottom: 12px; }
.client-stat-row { display: flex; gap: 8px; flex-wrap: wrap; }
.client-stat { background: var(--bg3); border-radius: var(--r-sm); padding: 7px 11px; text-align: center; border: 1px solid var(--border); }
.cs-val { font-size: 14px; font-weight: 800; font-family: 'JetBrains Mono', monospace; letter-spacing: -0.01em; }
.cs-lbl { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ══ TOAST ══ */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg2);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
  opacity: 0;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ── Markdown rendering in chat bubbles ─────────────────── */
.md-body h1,.md-body h2,.md-body h3{margin:.6em 0 .3em;font-weight:700;line-height:1.3;}
.md-body h1{font-size:1.1em;color:var(--primary);}
.md-body h2{font-size:1em;color:var(--text);border-bottom:1px solid var(--border);padding-bottom:3px;}
.md-body h3{font-size:.95em;color:var(--text);}
.md-body p{margin:.4em 0;line-height:1.6;}
.md-body ul,.md-body ol{margin:.4em 0 .4em 1.2em;line-height:1.7;}
.md-body li{margin:.15em 0;}
.md-body strong{color:var(--text);font-weight:700;}
.md-body em{color:var(--text2);}
.md-body code{background:var(--bg1);border:1px solid var(--border);border-radius:4px;padding:1px 5px;font-family:'JetBrains Mono',monospace;font-size:.85em;color:var(--primary);}
.md-body pre{background:var(--bg1);border:1px solid var(--border);border-radius:6px;padding:10px 12px;overflow-x:auto;margin:.5em 0;}
.md-body pre code{background:none;border:none;padding:0;font-size:.82em;color:var(--text);}
.md-body table{width:100%;border-collapse:collapse;margin:.5em 0;font-size:.88em;}
.md-body th{background:var(--bg3);padding:6px 10px;text-align:left;font-weight:700;border:1px solid var(--border);color:var(--text2);}
.md-body td{padding:5px 10px;border:1px solid var(--border);color:var(--text);}
.md-body tr:nth-child(even) td{background:var(--bg3);}
.md-body blockquote{border-left:3px solid var(--primary);margin:.5em 0;padding:.3em .8em;background:var(--primary-bg);color:var(--text2);border-radius:0 6px 6px 0;}
.md-body hr{border:none;border-top:1px solid var(--border);margin:.7em 0;}
.md-body a{color:var(--primary);text-decoration:none;}
.md-body a:hover{text-decoration:underline;}
@keyframes pulse{0%,100%{opacity:.3;}50%{opacity:1;}}

/* ── TASK / CONTENT LIST VIEW ─────────────────────────────── */
.task-list-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: border-color .15s;
}
.task-list-row:hover { border-color: var(--border2); }
.task-status-tag { flex-shrink: 0; }

/* ── SIDEBAR COLLAPSE BUTTON ──────────────────────────────── */
.sidebar-collapse-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .12s, color .12s;
  padding: 0;
}
.sidebar-collapse-btn:hover { background: var(--bg2); color: var(--text); }

/* ── SIDEBAR COLLAPSED STATE ──────────────────────────────── */
.sidebar.collapsed { width: 54px; }
.sidebar.collapsed .sidebar-label { display: none; }
.sidebar.collapsed .sidebar-logo-top { justify-content: center; }
.sidebar.collapsed .logo-text { display: none; }
.sidebar.collapsed .logo-sub { display: none; }
.sidebar.collapsed .nav-section { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 7px 0; margin: 1px 4px; }
.sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .kill-btn { padding: 6px; justify-content: center; }
.sidebar.collapsed .kill-btn .kill-dot { margin: 0; }

/* ── MEM CARD SLIM ────────────────────────────────────────── */
.mem-card-slim { padding: 8px 12px !important; }
.mem-card-slim .mem-preview { display: none; }
