/* ── HTMX loading indicators ─────────────────────────────────────────────── */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease-in; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

.htmx-not-indicator { display: inline; }
.htmx-request .htmx-not-indicator { display: none; }

/* ── Lateral chat panel (mirrors XciPub #agent-panel) ───────────────────── */
#pathassist-chat-panel {
  position: fixed;
  top: 50px;
  right: 0;
  width: 420px;
  height: calc(100vh - 50px);
  background: #fff;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.28s ease;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  font-size: 14px;
}
#pathassist-chat-panel.open { transform: translateX(0); }

#pathassist-chat-resize {
  position: absolute;
  left: 0; top: 0;
  width: 5px; height: 100%;
  cursor: ew-resize; z-index: 10;
  background: transparent;
}
#pathassist-chat-resize:hover { background: rgba(79, 70, 229, 0.15); }

#pathassist-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(135deg, #4f46e5, #9333ea);
  border-bottom: 1px solid #4338ca;
  flex-shrink: 0;
}
#pathassist-chat-header button {
  background: none; border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px; cursor: pointer;
  padding: 2px 6px; border-radius: 4px;
}
#pathassist-chat-header button:hover {
  background: rgba(0, 0, 0, 0.15);
  color: #fff;
}

#pathassist-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f9fafb;
}

.pathassist-msg {
  border-radius: 12px;
  padding: 10px 13px;
  max-width: 90%;
  line-height: 1.55;
  font-size: 13px;
}
.pathassist-msg.user {
  background: #4f46e5;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}
.pathassist-msg.assistant {
  background: #fff;
  color: #222;
  align-self: flex-start;
  border-bottom-left-radius: 2px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.chat-sources {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #f3f4f6;
  font-size: 11px;
}
.chat-sources-label {
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.chat-sources ul { list-style: none; padding: 0; margin: 0; }
.chat-sources li { margin-bottom: 2px; }
.chat-sources a {
  color: #4f46e5;
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-sources a:hover { text-decoration: underline; }

#pathassist-chat-input-area {
  flex-shrink: 0;
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}
#pathassist-chat-input {
  flex: 1;
  resize: none;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  min-height: 38px;
  max-height: 100px;
  overflow-y: auto;
  line-height: 1.4;
  width: 100%;
  font-family: inherit;
}
#pathassist-chat-input:focus { outline: none; border-color: #4f46e5; }

#pathassist-chat-send {
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  height: 38px;
  line-height: 1;
  transition: background 0.15s;
}
#pathassist-chat-send:hover { background: #4338ca; }
#pathassist-chat-send:disabled { background: #9ca3af; cursor: default; }

/* Vertical toggle tab at right edge */
#pathassist-chat-toggle {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 6px 0 0 6px;
  padding: 14px 6px;
  cursor: pointer;
  z-index: 1049;
  writing-mode: vertical-rl;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
  transition: background 0.2s;
}
#pathassist-chat-toggle:hover { background: #4338ca; }

/* ── Smooth transition on HTMX content swaps ────────────────────────────── */
#plan-container, #results-container {
  transition: opacity 150ms ease-in;
}

/* ── W3.CSS conflict isolation ───────────────────────────────────────────── */
#pathassist-root table th,
#pathassist-root table td {
  text-align: left;
  font-size: inherit;
}
