/* KITech Setup Assistant — floating help widget */
:root {
  --ksa-accent: #2563eb;
  --ksa-accent-dark: #1d4ed8;
}

#ksa-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99999;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

#ksa-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 999px;
  background: var(--ksa-accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
}
#ksa-toggle:hover { background: var(--ksa-accent-dark); }
.ksa-toggle-icon { font-size: 1.1rem; }

#ksa-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(380px, calc(100vw - 36px));
  max-height: min(520px, calc(100vh - 100px));
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#ksa-panel[hidden] {
  display: none !important;
}

.ksa-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--ksa-accent);
  color: #fff;
}
.ksa-head button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.ksa-log {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  background: #f8fafc;
  min-height: 120px;
}

.ksa-msg { margin-bottom: 10px; max-width: 95%; }
.ksa-msg--user {
  margin-left: auto;
  background: var(--ksa-accent);
  color: #fff;
  padding: 8px 10px;
  border-radius: 12px 12px 4px 12px;
  font-size: 0.92rem;
}
.ksa-msg--bot {
  background: #fff;
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
  border-radius: 12px 12px 12px 4px;
  font-size: 0.92rem;
}
.ksa-msg--bot ol { margin: 6px 0 0 1.1rem; padding: 0; }
.ksa-msg--bot li { margin-bottom: 4px; }
.ksa-links a { color: var(--ksa-accent); font-weight: 600; }

.ksa-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  border-top: 1px solid #e5e7eb;
  max-height: 88px;
  overflow-y: auto;
}
.ksa-topic-btn {
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
}
.ksa-topic-btn:hover { background: #eff6ff; border-color: var(--ksa-accent); }

.ksa-form {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid #e5e7eb;
}
.ksa-form input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.92rem;
}
.ksa-form button {
  border: none;
  background: var(--ksa-accent);
  color: #fff;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 480px) {
  .ksa-toggle-label { display: none; }
  #ksa-panel { width: calc(100vw - 24px); right: -6px; }
}
